Specifications
44 Troubleshooting and Portability Issues Chapter 4
32035 Rev. 3.22 November 2007
Compiler Usage Guidelines for AMD64 Platforms
As a diagnostic step, try building the program using x87 operations for floating-point computations
and see if the results are as expected. Use the -tp=k8-32 and -fast switches instead of the switches
recommended in the general performance guidelines.
Because not using those switches recommended in the general performance guidelines could lower
performance, the user should investigate the precision requirements of the program. If the user has
access to the source code, it may be possible to adapt the algorithm to SSE2.
4.1.4 Program Gives Unexpected Results or Terminates
Unexpectedly
Are your binary input data files big-endian?
If your Fortran program is performing unformatted I/O, and the data files are big-endian, use the
-Mbyteswapio switch for swapping endian formats.
4.2 GCC Compilers (64-Bit) for Linux
®
This section addresses errors and unexpected results that may be encountered when using 64-bit GCC
compilers for Linux.
4.2.1 Compilation Errors
Do you need ANSI-compliant code?
If a developer requires ANSI-compliant code in a program, GCC 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.
Does your code suffer from 64-bit portability issues, such as type casting pointers to int?
GCC provides the -Wall switch to show all warnings. This switch enables the user to detect 64-bit
portability issues, such as type-casting pointers to int.
On 64-bit Linux, int is 32 bits, and pointers and long are 64 bits (LP64). Do not use int for type-
casting pointers. Use ISO C99 portable, scalable data-types such as intptr_t for this purpose.
Additional information on this can be obtained in the ISO C99 Standard document.
Users should note that -Wall is not sufficient to get all warnings from gcc. The following switches are
avalaible that turn GCC into an effective 'lint': -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 detail on these
switches refer to the gcc manual.