Specifications

Chapter 4 Troubleshooting and Portability Issues 41
Compiler Usage Guidelines for AMD64 Platforms
32035 Rev. 3.22 November 2007
Chapter 4 Troubleshooting and Portability
Issues
Tuning code for optimal performance presents a wide variety of challenges from compilation errors to
unexpected results. This chapter presents the developer with a series of diagnostic steps for a given
compiler to troubleshoot errors encountered when compiling or running code.
Troubleshooting issues fall into the following broad categories:
Compilation errors
Interoperability between languages
Link-time errors
Run-time errors
Compiled and linked code generates unexpected results
Other issues
4.1 PGI Compilers for Linux
®
and Microsoft
®
Windows
®
This section addresses errors and unexpected results that may be encountered when using 32-bit
and/or 64-bit PGI compilers for Linux and Microsoft
®
Windows
®
.
4.1.1 Interoperability Between Languages
Is your program composed of both C/C++ and Fortran modules?
This section discusses several issues that can arise when linking together Fortran and C/C++ modules.
Definition of main() in a C/C++ Module
When linking together C and Fortran object files using the pgf90 invocation command, if the
main() function is included in one of the C objects, use the -Mnomain switch. Using the
-Mnomain switch instructs the PGI compiler not to include the Fortran main program module
during linking.
Ensuring Cases and Underscores Match
By default Linux and Microsoft Windows convert all Fortran symbol names to lower-case. C and C++
are case sensitive, so upper-case function names stay upper-case. When using inter-language calling,
either name the C/C++ functions with lower-case names, or invoke the Fortran compiler command