Specifications

48 Troubleshooting and Portability Issues Chapter 4
32035 Rev. 3.22 November 2007
Compiler Usage Guidelines for AMD64 Platforms
Enable exception handling with the appropriate /EH switch.
4.7 Sun Compilers (64-bit) for Solaris
See section 4.13, “Sun Compilers (32-bit) for Solaris”, on page 54 for the portability and
troubleshooting issues with this compiler.
4.8 GCC Compilers (32-Bit) for Linux
®
This section addresses errors and unexpected results that may be encountered when using 32-bit GNU
Compiler Collection (GCC) compilers for Linux®.
4.8.1 Compilation Errors
Do you need ANSI-compliant code?
If a developer requires ANSI-compliant code in a program, the GCC compiler provides the -ansi
switch to test the ANSI-compliance of the code in a program. To see gratuitous errors and warnings
for the non-ANSI parts of the program, the user should use the -pedantic switch. The user can then
modify the program to be ANSI-compliant. The user can also use the -std switch to specify the
required version of ISO C.
GCC also provides the -Wall switch to show almost all warnings. This switch enables all the
warnings about constructions that some users consider questionable.
Users should note that -Wall is not sufficient to get all warnings from gcc. Warning switches that turn
GCC into an effective 'lint' are: -Werror, -Wall, -W, -Wstrict-prototypes, -Wmissing-prototypes, -
Wpointer-arith, -Wreturn-type, -Wcast-qual, -Wwrite-strings, -Wswitch, -Wshadow,
-Wcast-align, -Wuninitialized, -Wbad-function-cast, -Wchar-subscripts, -Winline,
-Wnested-externs, -Wredundant-decl, -ansi, -pedantic. For further details on these switches, refer
to the GCC manual.
4.8.2 Link-Time Errors
Are you trying to link C and Fortran code?
Compile the Fortran 77 code with the -fno-f2c switch. The -fno-f2c switch prevents the g77
command from generating code designed to be compatible with code generated by the f2c command
and uses the GNU calling conventions instead.
4.8.3 Run-Time Errors
Is your code causing buffer overruns?
Turn on the -fbounds-check switch. When the -fbounds-check switch is turned on, the GCC
compiler generates additional code that checks whether the indices used to access arrays are or are not