Figures
What's New for XL Fortran
Introduction
Overview of XL Fortran Features
Hardware and Operating-System Support
Language Support
Migration Support
Source-Code Conformance Checking
Highly Configurable Compiler
Diagnostic Listings
Symbolic Debugger Support
Program Optimization
Documentation and Online Help
Setting Up and Customizing XL Fortran
Where to Find Installation Instructions
Using the Compiler on a Network File System
Correct Settings for Environment Variables
Environment Variable Basics
Environment Variables for National Language Support
Setting Library Search Paths
PDFDIR: Specifying the Directory for PDF Profile Information
TMPDIR: Specifying a Directory for Temporary Files
XLFSCRATCH_unit: Specifying Names for Scratch Files
XLFUNIT_unit: Specifying Names for Implicitly Connected Files
Customizing the Configuration File
Attributes
What a Configuration File Looks Like
Determining Which Level of XL Fortran Is Installed
Running Two Levels of XL Fortran
Editing, Compiling, Linking, and Running XL Fortran Programs
Editing XL Fortran Source Files
Compiling XL Fortran Programs
Compiling Fortran 90 or Fortran 95 Programs
Compiling XL Fortran SMP Programs
Compilation Order for Fortran Programs
Canceling a Compilation
XL Fortran Input Files
XL Fortran Output Files
Scope and Precedence of Option Settings
Specifying Options on the Command Line
Specifying Options in the Source File
Passing Command-Line Options to the "ld" or "as" Commands
Displaying Information inside Binary Files (strings)
Compiling for Specific Architectures
Passing Fortran Files through the C Preprocessor
cpp Directives for XL Fortran Programs
Passing Options to the C Preprocessor
Avoiding Preprocessing Problems
Linking XL Fortran Programs
Compiling and Linking in Separate Steps
Passing Options to the ld Command
Dynamic and Static Linking
Avoiding Naming Conflicts during Linking
Running XL Fortran Programs
Canceling Execution
Compiling and Executing on Different Systems
Run-Time Libraries for POSIX Pthreads Support
Selecting the Language for Run-Time Messages
Setting Run-Time Options
OpenMP Environment Variables
Other Environment Variables That Affect Run-Time Behavior
XL Fortran Run-Time Exceptions
XL Fortran Compiler-Option Reference
Summary of the XL Fortran Compiler Options
Options That Control Input to the Compiler
Options That Specify the Locations of Output Files
Options for Performance Optimization
Options for Error Checking and Debugging
Options That Control Listings and Messages
Options for Compatibility
Options for Floating-Point Processing
Options That Control Linking
Options That Control Other Compiler Operations
Options That Are Obsolete or Not Recommended
Detailed Descriptions of the XL Fortran Compiler Options
-# Option
-1 Option
-B Option
-C Option
-c Option
-D Option
-d Option
-F Option
-g Option
-I Option
-k Option
-L Option
-l Option
-N Option
-O Option
-o Option
-p Option
-Q Option
-q32 Option
-q64 Option
-qalias Option
-qalign Option
-qarch Option
-qassert Option
-qattr Option
-qautodbl Option
-qbigdata Option
-qcache Option
-qcclines Option
-qcheck Option
-qci Option
-qcompact Option
-qcr Option
-qctyplss Option
-qdbg Option
-qddim Option
-qdirective Option
-qdirectstorage Option
-qdlines Option
-qdpc Option
-qenablevmx Option
-qescape Option
-qessl Option
-qextern Option
-qextname Option
-qfixed Option
-qflag Option
-qfloat Option
-qflttrap Option
-qfree Option
-qfullpath Option
-qhalt Option
-qhot Option
-qieee Option
-qinit Option
-qinitauto Option
-qintlog Option
-qintsize Option
-qipa Option
-qkeepparm Option
-qlanglvl Option
-qlibansi Option
-qlibposix Option
-qlist Option
-qlistopt Option
-qlog4 Option
-qmaxmem Option
-qmbcs Option
-qminimaltoc Option
-qmixed Option
-qmoddir Option
-qmodule Option
-qnoprint Option
-qnullterm Option
-qobject Option
-qonetrip Option
-qoptimize Option
-qpdf Option
-qphsinfo Option
-qpic Option
-qport Option
-qposition Option
-qprefetch Option
-qqcount Option
-qrealsize Option
-qrecur Option
-qreport Option
-qsaa Option
-qsave Option
-qsaveopt Option
-qsclk Option
-qshowpdf Option
-qsigtrap Option
-qsmallstack Option
-qsmp Option
-qsource Option
-qspillsize Option
-qstrict Option
-qstrictieeemod Option
-qstrict_induction Option
-qsuffix Option
-qsuppress Option
-qswapomp Option
-qtbtable Option
-qthreaded Option
-qtune Option
-qundef Option
-qunroll Option
-qunwind Option
-qversion Option
-qwarn64 Option
-qxflag=dvz Option
-qxflag=oldtab Option
-qxlf77 Option
-qxlf90 Option
-qxlines Option
-qxref Option
-qzerosize Option
-S Option
-t Option
-U Option
-u Option
-v Option
-V Option
-W Option
-w Option
-y Option
Using XL Fortran in a 64-Bit Environment
Compiler Options for the 64-Bit Environment
-q32 Option
-q64 Option
-qwarn64 Option
XL Fortran Floating-Point Processing
IEEE Floating-Point Overview
Compiling for Strict IEEE Conformance
IEEE Single- and Double-Precision Values
IEEE Extended-Precision Values
Infinities and NaNs
Exception-Handling Model
Hardware-Specific Floating-Point Overview
Single- and Double-Precision Values
Extended-Precision Values
How XL Fortran Rounds Floating-Point Calculations
Selecting the Rounding Mode
Minimizing Rounding Errors
Minimizing Overall Rounding
Delaying Rounding until Run Time
Ensuring that the Rounding Mode is Consistent
Duplicating the Floating-Point Results of Other Systems
Maximizing Floating-Point Performance
Detecting and Trapping Floating-Point Exceptions
Compiler Features for Trapping Floating-Point Exceptions
Installing an Exception Handler
Controlling the Floating-Point Status and Control Register
xlf_fp_util Procedures
fpgets and fpsets Subroutines
Sample Programs for Exception Handling
Causing Exceptions for Particular Variables
Minimizing the Performance Impact of Floating-Point Exception Trapping
Optimizing XL Fortran Programs
The Philosophy of XL Fortran Optimizations
Summary of Compiler Options for Optimization
Choosing an Optimization Level
Optimization Level -O2
Optimization Level -O3
Getting the Most out of -O2 and -O3
The -O4 and -O5 Options
Optimizing for a Target Machine or Class of Machines
Getting the Most out of Target Machine Options
Optimizing Floating-Point Calculations
High-order Transformations (-qhot)
Getting the Most out of -qhot
Optimizing Loops and Array Language
Profile-directed Feedback (PDF)
Using Profile-directed Feedback (PDF)
Optimizing Conditional Branching
Interprocedural Analysis (-qipa)
Getting the Most from -qipa
Optimizing Subprogram Calls
Finding the Right Level of Inlining
Shared-memory Parallelism (-qsmp)
Getting the Most out of -qsmp
Other Program Behavior Options
Other Performance Options
Debugging Optimized Code
Different Results in Optimized Programs
Compiler-friendly Programming
Implementation Details of XL Fortran Input/Output
Implementation Details of File Formats
File Names
Preconnected and Implicitly Connected Files
File Positioning
I/O Redirection
How XLF I/O Interacts with Pipes, Special Files, and Links
Default Record Lengths
File Permissions
Selecting Error Messages and Recovery Actions
Flushing I/O Buffers
Choosing Locations and Names for Input/Output Files
Naming Files That Are Connected with No Explicit Name
Naming Scratch Files
Asynchronous I/O
Execution of an Asychronous Data Transfer Operation
Usage
Performance
Compiler-Generated Temporary I/O Items
Error Handling
XL Fortran Thread-Safe I/O Library
Use of I/O Statements in Signal Handlers
Asynchronous Thread Cancellation
Interlanguage Calls
Conventions for XL Fortran External Names
Mixed-Language Input and Output
Mixing Fortran and C++
Making Calls to C Functions Work
Passing Data From One Language to Another
Passing Arguments between Languages
Passing Global Variables between Languages
Passing Character Types between Languages
Passing Arrays between Languages
Passing Pointers between Languages
Passing Arguments By Reference or By Value
Passing Complex Values to/from gcc
Returning Values from Fortran Functions
Arguments with the OPTIONAL Attribute
Arguments with the INTENT Attribute
Type Encoding and Checking
Assembler-Level Subroutine Linkage Conventions
The Stack
The Link Area and Minimum Stack Frame
The Input Parameter Area
The Register Save Area
The Local Stack Area
The Output Parameter Area
Linkage Convention for Argument Passing
Argument Passing Rules (by Value)
Order of Arguments in Argument List
Linkage Convention for Function Calls
Pointers to Functions
Function Values
The Stack Floor
Stack Overflow
Prolog and Epilog
Traceback
THREADLOCAL Common Blocks and ILC with C
Example
Problem Determination and Debugging
Understanding XL Fortran Error Messages
Error Severity
Compiler Return Code
Run-Time Return Code
Understanding XL Fortran Messages
Limiting the Number of Compile-Time Messages
Selecting the Language for Messages
Fixing Installation or System Environment Problems
Fixing Compile-Time Problems
Duplicating Extensions from Other Systems
Isolating Problems with Individual Compilation Units
Compiling with Thread-safe Commands
Running out of Machine Resources
Fixing Link-Time Problems
Fixing Run-Time Problems
Duplicating Extensions from Other Systems
Mismatched Sizes or Types for Arguments
Working around Problems when Optimizing
Input/Output Errors
Tracebacks and Core Dumps
Debugging a Fortran 90 or Fortran 95 Program
Understanding XL Fortran Compiler Listings
Header Section
Options Section
Source Section
Error Messages
Transformation Report Section
Attribute and Cross-Reference Section
Object Section
File Table Section
Compilation Unit Epilogue Section
Compilation Epilogue Section
Porting Programs to XL Fortran
Outline of the Porting Process
Portability of Directives
NEW
Common Industry Extensions That XL Fortran Supports
Mixing Data Types in Statements
Date and Time Routines
Other libc Routines
Changing the Default Sizes of Data Types
Name Conflicts between Your Procedures and XL Fortran Intrinsic Procedures
Reproducing Results from Other Systems
Finding Nonstandard Extensions
Appendix A. Sample Fortran Programs
Example 1 - XL Fortran Source File
Execution Results
Example 2 - Valid C Routine Source File
Example 3 - Valid Fortran SMP Source File
Example 4 - Invalid Fortran SMP Source File
Programming Examples Using the Pthreads Library Module
Appendix B. XL Fortran Technical Information
The Compiler Phases
External Names in XL Fortran Libraries
The XL Fortran Run-Time Environment
External Names in the Run-Time Environment
Technical Details of the -qfloat=hsflt Option
Implementation Details for -qautodbl Promotion and Padding
Terminology
Examples of Storage Relationships for -qautodbl Suboptions
Appendix C. Using the Mathematical Acceleration Subsystem (MASS)
Using the Vector Libraries
Consistency of MASS Vector Functions
Compiling and Linking a Program with MASS
Appendix D. XL Fortran Internal Limits
Glossary
