Specifications
Chapter 4 Troubleshooting and Portability Issues 43
Compiler Usage Guidelines for AMD64 Platforms
32035 Rev. 3.22 November 2007
Fortran and C/C++ arrays also use different storage methods. Fortran uses column-major order, and
C/C++ uses row-major order. This poses no problems for one-dimensional arrays. For two-
dimensional arrays, where there are an equal number of rows and columns, simply reverse the row
and column indices. For arrays other than single dimensional arrays, and square two-dimensional
arrays, inter-language function mixing is not recommended.
Linking Fortran Modules with C/C++ Main Programs
You must explicitly link in the PGI Fortran runtime support libraries when linking pgf90-compiled
program units into C or C++ main programs (C/C++ calling Fortan) using the switches -lpgf90, -
lpgf90_rpm1, -lpgf902, -lpgf90rtl, and -lpgftnrtl. When linking pgf77-compiled program units into
C or C++ main programs, you need to use only the -lpgftnrtl switch.
4.1.2 Run-Time Errors
Does your program expect 64-bit integers?
By default, the Fortran INTEGER data-type is a 32-bit entity in AMD64. If a program expects
INTEGER to be a 64-bit entity (e.g., programs ported from some 64-bit architecture, such as Alpha),
use the -i8 switch. The -i8 switch makes all integers 64-bit entities. This switch is only available for
the PGI Fortran compiler (pgf90).
Are you receiving a run-time error?
Check for array overruns. Run-time errors can be caused by accessing arrays out-of-bounds. Use the
switch -Mbounds to generate code for checking array bounds.
4.1.3 Compiled and Linked Code Generates Unexpected Results
Are you generating vectorized code?
For some loops, vectorization can cause a slight difference in results due to the reordering of floating-
point operations. Using the switch combination -tp=k8-64 and -fastsse may cause vectorization. Try
using the non-vectorizing switch combination -tp=k8-64, -Mscalarsse, and -fast as a diagnostic step
instead. As an alternative to the vectorizing switches, use the non-vectorizing switches if their use
causes your code to give the correct, expected behavior.
Does your program require floating-point divisions conforming to the IEEE 754 standard?
Use the -Kieee=strict switch to generate floating-point divisions that are strictly compliant with the
IEEE 754 standard.
Does your program rely on x87 features?
The -fastsse switch instructs the compiler to use SSE2 registers and instructions. If the results of a
program do not match your expectations when using SSE2 registers and instructions, the program
may rely on some x87 features.