Compiler messages

When the compiler encounters a programming error while compiling a C or C++ source program, it issues a diagnostic message to the standard error device and if the appropriate options have been selected, to the listing file.

This section also outlines some of the basic reporting mechanisms the compiler uses to describe compilation errors.

The compiler issues messages specific to the C or C++ language.

C only If you specify the compiler option -qsrcmsg and the error is applicable to a particular line of code, the reconstructed source line or partial source line is included with the error message in the stderr file. A reconstructed source line is a preprocessed source line that has all the macros expanded.

If you specify the -qsource compiler option, the compiler will place messages in the source listing. For example, if you compile your file using the command line invocation xlc -qsource filename.c, then you will find a file called filename.lst in your current directory.

You can control the diagnostic messages issued, according to their severity, using either the -qflag option or the -w option. To get additional informational messages about potential problems in your program, use the -qinfo option.

Compiler message format

Diagnostic messages have the following format when the -qnosrcmsg option is active (which is the default):

"file", line line_number.column_number: 15dd-nnn (severity) text. 

where:

file is the name of the C or C++ source file with the error
line_number is the line number of the error
column_number is the column number for the error
15 is the compiler product identifier
dd is a two-digit code indicating the XL C/C++ component that issued the message. dd can have the following values:
00
- code generating or optimizing message
01
- compiler services message
05
- message specific to the C compiler
06
- message specific to the C compiler
40
- message specific to the C++ compiler
47
- message specific to C++ linkage helper utility
86
- message specific to interprocedural analysis (IPA)
nnn is the message number
severity is a letter representing the severity of the error
text is a message describing the error

Diagnostic messages have the following format when the -qsrcmsg option is specified:

x - 15dd-nnn(severity) text.

where x is a letter referring to a finger in the finger line.

Message severity levels and compiler response

XL C/C++ uses a five-level classification scheme for diagnostic messages. Each level of severity is associated with a compiler response. Not every error halts compilation. The following table provides a key to the abbreviations for the severity levels and the associated compiler response.

Letter Severity Compiler response
I Informational Compilation continues. The message reports conditions found during compilation.
W Warning Compilation continues. The message reports valid but possibly unintended conditions.
E Error C only Compilation continues and object code is generated. Error conditions exist that the compiler can correct, but the program might not produce the expected results.
S Severe error Compilation continues, but object code is not generated. Error conditions exist that the compiler cannot correct.
U Unrecoverable error The compiler halts. An internal compiler error has occurred.
  • If the message indicates a resource limit (for example, file system full or paging space full), provide additional resources and recompile.
  • If the message indicates that different compiler options are needed, recompile using them.
  • Check for and correct any other errors reported prior to the unrecoverable error.
  • If the message indicates an internal compiler error, the message should be reported to your IBM service representative.

Related information