Compiler Message System Use
This topic describes how to use the message system to control and use messages issued by the compiler.
This topic describes how to use the message system to control and use messages issued by the compiler. Explanatory texts for messages can be displayed online through the use of the explain command.
Expand Messages with the explain Command
Use the explain command to display an explanation of any message issued by the compiler. The command takes as an argument, the message number, including the number's prefix. The prefix for Cray C and C++ is CC.
% cc bug.c
CC-24 cc: ERROR File = bug.c, Line = 1
An invalid octal constant is used.
int i = 018;
^
1 error detected in the compilation of "bug.c".
% explain CC-24
An invalid octal constant is used.
Each digit of an octal constant must be between 0 and 7, inclusive. One or
more digits in the indicated octal constant are outside of this range.
Change each digit in the octal constant to be within the valid range.Control the Use of Messages
This section summarizes the command line options that affect the issuing of messages from the compiler.
- -h errorlimit[=n]
- Specifies the maximum number of error messages the compiler prints before it exits.
- -h [no]message=n[:...]
- Enables or disables the specified compiler messages, overriding -h msglevel.
- -h msglevel_n
- Specifies the lowest severity level of messages to be issued.
- -h [no]msgs
- Enables or disables the writing of optimization messages to stderr.
- h [no]negmsgs
- Enables or disables the writing of messages to stderr that indicate why optimizations such as vectorization, inlining, or cloning did not occur in a given instance.
- -h report=args
- Generates optimization report messages.
- NLSPATH
- Specifies the default value of the message system search path environment variable.
- LANG
- Identifies the requirements for native language, local customs, and coded character set with regard to the message system.
- MSG_FORMAT
- Controls the format in which error messages are received.
#
setenv ORIG_CMD_NAME 'basename $0'
cc $*CC-8 newcc: ERROR File = x.c, Line = 1
A new-line character appears inside a string literal.Because the environment variable ORIG_CMD_NAME is set to newcc, this appears as the command name instead of cc in this message.
The ORIG_CMD_NAME environment variable is not part of the message system. It is supported by the Cray C and C++ compilers as an aid to programmers. Other products, such as the Fortran compiler and the linker, may support this variable. However, do not rely on support for this variable in any other product.
Be careful when setting the environment variable ORIG_CMD_NAME. If setting ORIG_CMD_NAME inadvertently, the compiler may generate messages with an incorrect command name. This may be particularly confusing if, for example, ORIG_CMD_NAME is set to newcc when the Fortran compiler prints a message. The Fortran message will look as though it came from newcc.
Message Severity
- COMMENT
- Inefficient programming practices.
- NOTE
- Unusual programming style or the use of outmoded statements.
- CAUTION
- Possible user error. Cautions are issued when the compiler detects a condition that may cause the program to abort or behave unpredictably.
- WARNING
- Probable user error. Indicates that the program will probably abort or behave unpredictably.
- ERROR
- Fatal error; that is, a serious error in the source code. No binary output is produced.
- INTERNAL
- Problems in the compilation process. Please report internal errors immediately to the system support staff, so that a bug report can be filed.
- LIMIT
- Compiler limits have been exceeded. Normally, the source code or environment can be modified to avoid these errors. If limit errors cannot be resolved by such modifications, please report these errors to the system support staff, so that a bug report can be filed.
- INFO
- Useful additional information about the compiled program.
- INLINE
- Information about inline code expansion performed on the compiled code.
- SCALAR
- Information about scalar optimizations performed on the compiled code.
- VECTOR
- Information about vectorization optimizations performed on the compiled code.
- OPTIMIZATION
- Information about general optimizations.
- IPA_INFO
- Information about interprocedural optimizations.
Common System Messages
- Operand Range Error
An operand range error occurs when a program attempts to load or store in an area of memory that is not part of the user's area. This usually occurs when an invalid pointer is dereferenced.
- Program Range Error
A program range error occurs when a program attempts to jump into an area of memory that is not part of the user's area. This may occur, for example, when a function in the program mistakenly overwrites the internal program stack. When this happens, the address of the function from which the function was called is lost. When the function attempts to return to the calling function, it jumps elsewhere instead.
- Error Exit
An error exit occurs when a program attempts to execute an invalid instruction. This error usually occurs when the program's code area has been mistakenly overwritten with words of data (for example, when the program stores in a location pointed to by an invalid pointer).