XL Fortran for AIX 8.1

User's Guide


Detailed Descriptions of the XL Fortran Compiler Options

The following alphabetical list of options provides all the information you should need to use each option effectively.

How to read the syntax information:

-# Option

Syntax:

-#

Generates information on the progress of the compilation without actually running the individual components.

Rules:

At the points where the compiler executes commands to perform different compilation steps, this option displays a simulation of the system calls it would do and the system argument lists it would pass, but it does not actually perform these actions.

Examining the output of this option can help you quickly and safely determine the following information for a particular compilation:

It avoids the overhead of compiling the source code and avoids overwriting any existing files, such as .lst files. (For those who are familiar with the make command, it is similar to make -n.)

Note that if you specify this option with -qipa, the compiler does not display linker information subsequent to the IPA link step. This is because the compiler does not actually call IPA.

Related Information:

The -v Option produces the same output but also performs the compilation.

-1 Option

Syntax:

-1
ONETRIP | NOONETRIP

Executes each DO loop in the compiled program at least once if its DO statement is executed, even if the iteration count is 0. This option provides compatibility with FORTRAN 66. The default is to follow the behavior of later Fortran standards, where DO loops are not performed if the iteration count is 0.

Restrictions:

It has no effect on FORALL statements, FORALL constructs, or array constructor implied-DO loops.

Related Information:

-qonetrip is the long form of -1.

-B Option

Syntax:

-Bprefix

Determines a substitute path name for executable files used during compilation, such as the compiler or linker. It can be used in combination with the -t option, which determines which of these components are affected by -B.

Arguments:

prefix is the name of a directory where the alternative executable files reside. It must end in a / (slash).

Rules:

To form the complete path name for each component, the driver program adds prefix to the standard program names. You can restrict the components that are affected by this option by also including one or more -tmnemonic options.

You can also specify default path names for these commands in the configuration file.

This option allows you to keep multiple levels of some or all of the XL Fortran components or to try out an upgraded component before installing it permanently. When keeping multiple levels of XL Fortran available, you might want to put the appropriate -B and -t options into a configuration-file stanza and to use the -F option to select the stanza to use.

Examples

In this example, an earlier level of the XL Fortran components is installed in the directory /usr/lpp/xlf/bin. To test the upgraded product before making it available to everyone, the system administrator restores the latest install image under the directory /home/jim and then tries it out with commands similar to:

xlf95 -tc -B/home/jim/usr/lpp/xlf/bin/ test_suite.f

Once the upgrade meets the acceptance criteria, the system administrator installs it over the old level in /usr/lpp/xlf/bin.

Related Information:

See -t Option, -F Option, Customizing the Configuration File, and Running Two Levels of XL Fortran.

-b64 Option

Syntax:

-b64

The AIX operating system provides 64-bit shared object files in both libc.a and libm.a. In 64-bit mode, you can use the -b64 linker option to instruct ld to bind with 64-bit objects.

Related Information:

For more information on the 64-bit environment, see Chapter 6, Using XL Fortran in a 64-bit Environment. For more information on -b64, see AIX General Programming Concepts.

-bdynamic, -bshared, and -bstatic Options

Syntax:

-bdynamic | -bshared | -bstatic

These options are toggles that are used to control the processing of -l options and the way that shared objects are processed.

The options -bdynamic and -bshared are synonymous.

When -bstatic is in effect, shared objects are statically linked into the output file. When -bdynamic is in effect, shared objects are linked dynamically.

When -brtl is used in conjunction with either -bdynamic or -bshared, the search for libraries specified with the -l option is satisfied by the suffix .so or .a. For each directory searched, a file with the suffix .so is looked for. If it is not found, a file with the suffix .a is looked for. If neither file is found, the search continues with the next directory.

Rules:

These options are passed directly to the ld command and are not processed by XL Fortran at all.

These options are position-significant. They affect all files that are specified after the option on the command-line.

Table 14 summarizes how these options interact with -brtl and -bnortl to affect the file suffix that is being searched.

Table 14. Interaction of New Linker Options

  Position-significant
-bdynamic
-bshared (default)
-bstatic
Global Influence -brtl .so
.a
.a
-bnortl (default) .a .a

Examples

xlf95 f.f -brtl -bshared -lmylib

In this case, the linker searches for the library libmylib.so first and then the library libmylib.a in each directory in the search path consecutively until either is encountered.

xlf95_r f.f -bdynamic -llib1 -bstatic -llib2 -brtl

In this case, to satisfy the first library specification, the linker searches for the library liblib1.so first and then the library liblib1.a in each directory (as described in the previous example). However, at the same time the linker only searches for liblib2.a in those same libraries.

Related Information:

For more information on these options, see AIX General Programming Concepts. See also -brtl Option.

-bhalt Option

Syntax:

-bhalt:error_level

Specifies the maximum error level that is allowed before the linker (ld) command halts. The default value is 4, as specified in the configuration file. If any linker command has an error return value greater than the value that is specified by the error_level variable, linking stops.

Rules:

This option is passed directly to the ld command and is not processed by XL Fortran at all.

-bloadmap Option

Syntax:

-bloadmap:name

Requests that a log of linker actions and messages be saved in file name. You can use the log to help diagnose linking problems. For example, the log contains information about type mismatches that the -qextchk option detected.

Rules:

This option is passed directly to the ld command and is not processed by XL Fortran at all.

-bmaxdata, -bmaxstack Options

Syntax:

-bmaxdata:bytes
-bmaxstack:bytes

Specifies the maximum amount of space to reserve for the program data segment and stack segment for programs where the size of these regions is a constraint.

Background Information:

The data segment holds, among other things, heap storage that is used by the program.

If your program allocates large arrays, statically or dynamically, specify -bmaxdata when linking the program. The resulting executable program uses the large data model and can have a data region larger than a single segment, up to a maximum of 2 GB. Refer to the ld documentation in the AIX Commands Reference for allowable values. Note that since the compiler might create temporary arrays during compilation, it may be useful to define a value for the -bmaxdata compiler option in anticipation of this.

If the program has large amounts of automatic data or otherwise exceeds the soft limit on stack size for a program, specify -bmaxstack when you link the program. Use this option to define the soft limit up to 256 MB for 32-bit mode or up to the limit imposed by system resources for 64-bit mode. However, each main program or subprogram is limited to 256 MB per instance.

Arguments:

You can specify the size as a decimal, octal (which is prefixed by 0), or hexadecimal value (which is prefixed by 0x).

Rules:

These options are passed directly to the ld command and are not processed by XL Fortran at all.

Examples

xlf95 -O3 -qhot -bmaxdata:0x20000000 huge_data_model.f
xlf95 -O3 -qhot -bmaxstack:2000000 lots_of_automatic_data.f

Related Information:

For a discussion of the issues involved in creating large AIX programs, see "Large Program Support Overview" in AIX General Programming Concepts.

-brtl Option

Syntax:

-brtl | -bnortl

Determines which algorithm will be used to find libraries that are specified with the -l option.

Background Information:

If -brtl is specified, run-time linking is enabled.

When used in conjunction with either -bdynamic or -bshared, the search for libraries that you specified with the -l option is satisfied by the suffix .so or .a. For each directory searched, a file with the suffix .so is looked for. If it is not found, a file with the suffix .a is looked for. If neither file is found, the search continues with the next directory. Table 14 gives a graphical representation of how these options combine to affect the file suffix being searched for.

Rules:

These options are passed directly to the ld command and are not processed by XL Fortran at all. Only the last specified of these options will be used. These options have a global effect; regardless of where they appear on the command line, they affect the entire command.

Examples

xlf95 -brtl f.f -lmylib
xlf95_r -bnortl f.f -bdynamic -llib1 -bstatic -llib2

Note that if you add -brtl to the end of the last example, it will override the earlier occurrence of -bnortl.

Related Information:

For more information on these options, see AIX General Programming Concepts. See also -bdynamic, -bshared, and -bstatic Options.

-bshared Option

Related Information:

See -bdynamic, -bshared, and -bstatic Options.

-bstatic Option

Related Information:

See -bdynamic, -bshared, and -bstatic Options.

-C Option

Syntax:

-C
CHECK | NOCHECK

Checks each reference to an array element, array section, or character substring for correctness.

Rules:

At compile time, if the compiler can determine that a reference goes out of bounds, the severity of the error reported is increased to S (severe) when this option is specified.

At run time, if a reference goes out of bounds, the program generates a SIGTRAP signal. By default, this signal ends the program and produces a core dump.

Because the run-time checking can slow execution, you should decide which is the more important factor for each program: the performance impact or the possibility of incorrect results if an error goes undetected. You might decide to use this option only while testing and debugging a program (if performance is more important) or also for compiling the production version (if safety is more important).

Related Information:

The -C option prevents some of the optimizations that the -qhot Option performs. You may want to remove the -C option after debugging of your code is complete and to add the -qhot option to achieve a more thorough optimization.

The valid bounds for character substring expressions differ depending on the setting of the -qzerosize option. See -qzerosize Option.

-qsigtrap Option and Installing an Exception Handler describe how to detect and recover from SIGTRAP signals without ending the program.

-qcheck is the long form of -C.

-c Option

Syntax:

-c

Prevents the completed object file from being sent to the ld command for link-editing. With this option, the output is a .o file for each source file.

Using the -o option in combination with -c selects a different name for the .o file. In this case, you can only compile one source file at a time.

Related Information:

See -o Option.

-D Option

Syntax:

-D
DLINES | NODLINES

Specifies whether the compiler compiles fixed-form lines with a D in column 1 or treats them as comments.

If you specify -D, the fixed-form lines that have a D in column 1 are compiled. The default action is to treat these lines as comment lines. They are typically used for sections of debugging code that need to be turned on and off.

Related Information:

-qdlines is the long form of -D.

-d Option

Syntax:

-d

Causes preprocessed source files that are produced by cpp to be kept rather than to be deleted.

Rules:

The files that this option produces have names of the form Ffilename.f, derived from the names of the original source files.

Related Information:

See Passing Fortran Files through the C Preprocessor.

-F Option

Syntax:

-Fconfig_file | -Fconfig_file:stanza | -F:stanza

Specifies an alternative configuration file, which stanza to use within the configuration file, or both.

The configuration file specifies different kinds of defaults, such as options for particular compilation steps and the locations of various files that the compiler requires. A default configuration file (/etc/xlf.cfg) is supplied at installation time. The default stanza depends on the name of the command used to invoke the compiler (xlf90, xlf90_r, xlf90_r7, xlf95, xlf95_r, xlf95_r7, xlf, xlf_r, xlf_r7, f77 or fort77).

A simple way to customize the way the compiler works, as an alternative to writing complicated compilation scripts, is to add new stanzas to /etc/xlf.cfg, giving each stanza a different name and a different set of default compiler options. You may find the single, centralized file easier to maintain than many scattered compilation scripts and makefiles.

By running the compiler with an appropriate -F option, you can select the set of options that you want. You might have one set for full optimization, another set for full error checking, and so on.

Restrictions:

Because the default configuration file is replaced each time a new compiler release is installed, make sure to save a copy of any new stanzas or compiler options that you add.

Examples

 # Use stanza debug in /etc/xlf.cfg.
   xlf95 -F:debug t.f
 
# Use stanza xlf90 in /home/fred/xlf.cfg.
   xlf95 -F/home/fred/xlf.cfg t.f
 
# Use stanza myxlf in /home/fred/xlf.cfg.
   xlf95_r -F/home/fred/xlf.cfg:myxlf t.f

Related Information:

Customizing the Configuration File explains the contents of a configuration file and tells how to select different stanzas in /etc/xlf.cfg without using the -F option.

-g Option

Syntax:

-g
DBG | NODBG

Generates debug information for use by a symbolic debugger.

Related Information:

See Debugging a Fortran 90 or Fortran 95 Program, A Sample dbx Session for an XL Fortran Program, and Symbolic Debugger Support.

-qdbg is the long form of -g.

-I Option

Syntax:

-Idir

Adds a directory to the search path for include files and .mod files. If XL Fortran calls cpp, this option adds a directory to the search path for #include files. Before checking the default directories for include and .mod files, the compiler checks each directory in the search path. For include files, this path is only used if the file name in an INCLUDE line is not provided with an absolute path. For #include files, refer to the cpp documentation for the details of the -I option.

Arguments:

dir must be a valid path name (for example, /home/dir, /tmp, or ./subdir).

Rules:

The compiler appends a / to the dir and then concatenates that with the file name before making a search. If you specify more than one -I option on the command line, files are searched in the order of the dir names as they appear on the command line.

The following directories are searched, in this order, after any paths that are specified by -I options:

  1. The current directory (from which the compiler is executed)
  2. The directory where the source file is (if different from 1)
  3. /usr/include

Related Information:

The -qmoddir Option puts .mod files in a specific directory when you compile a file that contains modules.

-k Option

Syntax:

-k
FREE(F90)

Specifies that the program is in free form.

Applicable Product Levels:

The meaning of this option has changed from XL Fortran Version 2. To get the old behavior of -k, use the option -qfree=ibm instead.

Related Information:

See -qfree Option and "Free Source Form" in the XL Fortran for AIX Language Reference.

This option is the short form of -qfree=f90.

-L Option

Syntax:

-Ldir

Looks in the specified directory for libraries that are specified by the -l option. If you use libraries other than the default ones in /usr/lib, you can specify one or more -L options that point to the locations of the other libraries. You can also set the LIBPATH environment variable, which lets you specify a search path for libraries at run time.

Rules:

This option is passed directly to the ld command and is not processed by XL Fortran at all.

Related Information:

See Options That Control Linking and Linking XL Fortran Programs.

-l Option

Syntax:

-lkey

Searches the specified library file, where key selects the file libkey.a.

Rules:

This option is passed directly to the ld command and is not processed by XL Fortran at all.

Related Information:

See Options That Control Linking and Linking XL Fortran Programs.

-N Option

Syntax:

-NSbytes
SPILLSIZE(bytes)

Specifies the size of internal program storage areas.

Rules:

It defines the number of bytes of stack space to reserve in each subprogram, in case there are too many variables to hold in registers and the program needs temporary storage for register contents.

Defaults

By default, each subprogram stack has 512 bytes of spill space reserved.

If you need this option, a compile-time message informs you of the fact.

Related Information:

-qspillsize is the long form of -NS.

-O Option

Syntax:

-O[level]
OPTimize[(level)] | NOOPTimize

Specifies whether to optimize code during compilation and, if so, at which level:

Arguments:

not specified
Does no optimization on the generated code.

-O
For each release of XL Fortran, -O enables the level of optimization that represents the best combination of compilation speed and run-time performance. If you need a specific level of optimization, specify the appropriate numeric value. Currently, -O is equivalent to -O2.

-O0
All optimizations are disabled. This option is equivalent to -qnoopt

-O1
Reserved for future use. This form does not currently do any optimization and is ignored. In past releases, it was interpreted as a combination of the -O and -1 options, which may have had unintended results.

-O2
Performs a set of optimizations that are intended to offer improved performance without an unreasonable increase in time or storage that is required for compilation.

-O3
Performs additional optimizations that are memory intensive, compile-time intensive, and may change the semantics of the program slightly. We recommend these optimizations when the desire for run-time speed improvements outweighs the concern for limiting compile-time resources.

This level of optimization also affects the setting of the -qfloat option, turning on the fltint and rsqrt suboptions by default, and sets -qmaxmem=-1.

-O4
Aggressively optimizes the source program, trading off additional compile time for potential improvements in the generated code. You can specify the option at compile time or at link time. If you specify it at link time, it will have no effect unless you also specify it at compile time for at least the file that contains the main program.

-O4 implies the following other options:

Note that the auto setting of -qarch, -qtune, and -qcache implies that the execution environment will be the same as the compilation environment.

This option follows the "last option wins" conflict resolution rule, so any of the options that are modified by -O4 can be subsequently changed. Specifically, specifying the following allows aggressive intraprocedural optimization while maintaining code portability:

  -O4 -qarch=com

-O5
Provides all of the functionality of the -O4 option,but also provides the functionality of the -qipa=level=2 option.

Restrictions:

Generally, use the same optimization level for both the compile and link steps. This is important when using either the -O4 or -O5 optimization level to get the best run-time performance. For the -O5 level, all loop transformations (as specified via the -qhot option) are done at the link step.

Increasing the level of optimization may or may not result in additional performance improvements, depending on whether the additional analysis detects any further optimization opportunities.

An optimization level of -O3 or higher can change the behavior of the program and potentially cause exceptions that would not otherwise occur. Use of the -qstrict option can eliminate potential changes and exceptions.

Compilations with optimization may require more time and machine resources than other compilations.

The more the compiler optimizes a program, the more difficult it is to debug the program with a symbolic debugger.

Related Information:

-qessl Option allows the use of ESSL routines.

-qstrict Option shows how to turn off the effects of -O3 that might change the semantics of a program.

-qipa Option, -qhot Option, and -qpdf Option turn on additional optimizations that may improve performance for some programs.

Chapter 8, Optimizing XL Fortran Programs discusses technical details of the optimization techniques the compiler uses and some strategies you can use to get maximum performance from your code.

-qOPTimize is the long form of -O.

-o Option

Syntax:

-o name

Specifies a name for the output object, executable, or assembler source file.

To choose the name for an object file, use this option in combination with the -c option. For an assembler source file, use it in combination with the -S option.

Defaults

The default name for an executable file is a.out. The default name for an object or assembler source file is the same as the source file except that it has a .o or .s extension.

Rules:

Except when you specify the -c or -S option, the -o option is passed directly to the ld command, instead of being processed by XL Fortran.

Examples

xlf95 t.f                    # Produces "a.out"
xlf95 -c t.f                 # Produces "t.o"
xlf95 -o test_program t.f    # Produces "test_program"
xlf95 -S -o t2.s t.f         # Produces "t2.s"

-P Option

Syntax:

-P{v|k}[!]

Invokes the selected optimizing preprocessor. Adding ! prevents the compilation step from following preprocessing.

You can specify only one of these preprocessor options on the command line:

-Pk invokes the KAP preprocessor.
-Pv invokes the VAST-2 preprocessor.

Examples

This example shows sets of preprocessor options that perform a reasonable amount of optimization:

xlf95 test.f -Pk -Wp,-r=3 -O  # Reasonable set of KAP options
xlf95 test.f -Pv -Wp,-ew -O   # Reasonable set of VAST-2 options

This example shows how to save the preprocessed output in a file so that you can see what transformations the preprocessors do:

# Produces KAP preprocessor output file Ploops.f
  xlf95 -Pk! -Wp,-f loops.f
 
# Produces VAST-2 preprocessor output file Ploops.f
  xlf95 -Pv! -Wp,-o loops.f
Note:
Because the preprocessors are not included as part of XL Fortran, you must purchase them separately for this example to work.

Related Information:

Where to Find the Optimizing Preprocessors.

For information about other kinds of preprocessing (for conditional compilation and macro expansion), see Passing Fortran Files through the C Preprocessor.

-p Option

Syntax:

-p[g]

Sets up the object file for profiling.

-p prepares the program for profiling. When you execute the program, it produces a mon.out file with the profiling information. You can then use the prof command to generate a run-time profile.

-pg is like -p, but it produces more extensive statistics. Running a program compiled with -pg produces a gmon.out file, which you use with the gprof command to generate a run-time profile.

Rules:

For profiling, the compiler produces monitoring code that counts the number of times each routine is called. The compiler replaces the startup routine of each subprogram with one that calls the monitor subroutine at the start. When the program ends normally, it writes the recorded information to the mon.out or gmon.out file.

Examples


$ xlf95 -p needs_tuning.f
$ a.out
$ prof

·
·
·
profiling data
·
·
·
$ xlf95 -pg needs_tuning.f $ a.out $ gprof
·
·
·
detailed and verbose profiling data
·
·
·

Related Information:

For more information on profiling and the prof and gprof commands, see the AIX Commands Reference.

-Q Option

Syntax:

-Q+names | -Q-names | -Q | -Q!

Specifies whether Fortran 90 or Fortran 95 procedures are inlined and/or the names of particular procedures that should or should not be inlined. names is a list of procedure names that are separated by colons.

Rules:

By default, -Q only affects a procedure if both the caller and callee are in the same source file or set of files that are connected by INCLUDE directives. To turn on inline expansion for calls to procedures in different source files, you must also use the -qipa option.

Arguments:

The -Q option without any list inlines all appropriate procedures, subject to limits on the number of inlined calls and the amount of code size increase as a result. +names specifies the names, separated by colons, of procedures to inline and raises these limits for those procedures. -names specifies the names, separated by colons, of procedures not to inline. You can specify more than one of these options to precisely control which procedures are most likely to be inlined.

The -Q! option turns off inlining.

Restrictions:

You must specify at least level 2 of -O for -Q inlining to take effect.

If you specify inlining for a file, the following @PROCESS compiler directives are only effective if they come before the first compilation unit in the file: ALIAS, ALIGN, ATTR, COMPACT, DBG, EXTCHK, EXTNAME, FLOAT, FLTTRAP, HALT, IEEE, LIST, MAXMEM, OBJECT, OPTIMIZE, PHSINFO, SPILLSIZE, STRICT, and XREF.

Examples

xlf95  -O -Q many_small_subprogs.f   # Compiler decides what to inline.
xlf95  -O -Q+bigfunc:hugefunc test.f # Inline even though these are big.
xlf95  -O -Q -Q-only_once pi.f       # Inline except for this one procedure.

Related Information:

See -qipa Option.

-q32 Option

Related Information:

See -q32 Option.

-q64 Option

Related Information:

See -q64 Option.

-qalias Option

Syntax:

-qalias={[no]aryovrlp | [no]intptr | [no]pteovrlp | [no]std}...
ALIAS( {[NO]ARYOVRLP | [NO]INTPTR | [NO]PTEOVRLP | [NO]STD}... )

Indicates whether a program contains certain categories of aliasing. The compiler limits the scope of some optimizations when there is a possibility that different names are aliases for the same storage locations.

Arguments:

aryovrlp | noaryovrlp
Indicates whether the compilation units contain any array assignments between storage-associated arrays. If not, specify noaryovrlp to improve performance.

intptr | nointptr
Indicates whether the compilation units contain any integer POINTER statements. If so, specify INTPTR.

pteovrlp | nopteovrlp
Indicates whether any pointee variables may be used to refer to any data objects that are not pointee variables, or whether two pointee variables may be used to refer to the same storage location. If not, specify NOPTEOVRLP.

std | nostd
Indicates whether the compilation units contain any nonstandard aliasing (which is explained below). If so, specify nostd.

Rules:

An alias exists when an item in storage can be referred to by more than one name. The Fortran 90 and Fortran 95 standards allow some types of aliasing and disallow some others. The sophisticated optimizations that the XL Fortran compiler performs increase the likelihood of undesirable results when nonstandard aliasing is present, as in the following situations:

Applicable Product Levels:

-qalias=nostd replaces the option -qxflag=xalias and makes it obsolete.

The introduction of the -qipa option does not remove the need for -qalias.

Examples of aryovrlp/noaryovrlp/pteovrlp

If the following subroutine is compiled with -qalias=nopteovrlp, the compiler may be able to generate more efficient code. You can compile this subroutine with -qalias=nopteovrlp, because the integer pointers, ptr1 and ptr2, point at dynamically allocated memory only.

  subroutine sub(arg)
      real arg
      pointer(ptr1, pte1)
      pointer(ptr2, pte2)
      real pte1, pte2
 
      ptr1 = malloc(%val(4))
      ptr2 = malloc(%val(4))
      pte1 = arg*arg
      pte2 = int(sqrt(arg))
      arg = pte1 + pte2
      call free(%val(ptr1))
      call free(%val(ptr2))
  end subroutine 

If most array assignments in a compilation unit involve arrays that do not overlap but a few assignments do involve storage-associated arrays, you can code the overlapping assignments with an extra step so that the NOARYOVRLP suboption is still safe to use.

@PROCESS ALIAS(NOARYOVRLP)
! The assertion that no array assignments involve overlapping
! arrays allows the assignment to be done without creating a
! temporary array.
      program test
        real(8) a(100)
        integer :: j=1, k=50, m=51, n=100
 
        a(1:50) = 0.0d0
        a(51:100) = 1.0d0
 
        ! Timing loop to achieve accurate timing results
        do i = 1, 1000000
           a(j:k) = a(m:n)    ! Here is the array assignment
        end do
 
        print *, a
      end program

When SUB1 is called, an alias exists between J and K. J and K refer to the same item in storage. In Fortran, this aliasing is not permitted if J or K are updated, and, if it is left undetected, it can have unpredictable results. If you specify -qalias=nostd, changes to J alter the value of K and vice versa, and the results are predictable.

! We cannot assert that this unit is free
! of array-assignment aliasing because of the assignments below.
      subroutine sub1
      integer a(10), b(10)
      equivalence (a, b(3))
      a = b          ! a and b overlap.
      a = a(10:1:-1) ! The elements of a are reversed.
      end subroutine
 
! When the overlapping assignment is recoded to explicitly use a
! temporary array, the array-assignment aliasing is removed.
! Although ALIAS(NOARYOVRLP) does not speed up this assignment,
! subsequent assignments of non-overlapping arrays in this unit
! are optimized.
@PROCESS ALIAS(NOARYOVRLP)
      subroutine sub2
      integer a(10), b(10), t(10)
      equivalence (a, b(3))
      t = b; a = t
      t = a(10:1:-1); a = t
      end subroutine
       CALL SUB1(I,I)
       ...
       SUBROUTINE SUB1(J,K)

In the following example, the program might store 5 instead of 6 into J unless -qalias=nostd indicates that an alias might exist.

       INTEGER BIG(1000)
       INTEGER SMALL(10)
       COMMON // BIG
       EQUIVALENCE(BIG,SMALL)
       ...
       BIG(500) = 5
       SMALL (I) = 6   ! Where I has the value 500
       J = BIG(500)

Restrictions:

Because this option inhibits some optimizations of some variables, using it can lower performance.

Programs that contain nonstandard or integer POINTER aliasing may produce incorrect results if you do not compile them with the correct -qalias settings. The xlf90, xlf90_r, xlf90_r7, xlf95, xlf95_r, and xlf95_r7 commands assume that a program contains only standard aliasing (-qalias=aryovrlp:pteovrlp:std:nointptr), while the xlf_r, xlf_r7, xlf, and f77 commands, for compatibility with XL Fortran Version 2, assume that integer POINTERs may be present (-qalias=aryovrlp:pteovrlp:std:intptr).

-qalign Option

Syntax:

-qalign={[no]4k|struct={natural|packed|port}}
ALIGN({[NO]4K|STRUCT{(natural)|(packed)|(port)}})

Specifies the alignment of data objects in storage, which avoids performance problems with misaligned data. Both the [no]4k and struct options can be specified and are not mutually exclusive. The default setting is -qalign=no4k:struct=natural. The [no]4K option is useful primarily in combination with logical volume I/O and disk striping.

Arguments:

[no]4K
Specifies whether to align large data objects on page (4 KB) boundaries, for improved performance with data-striped I/O. Objects are affected depending on their representation within the object file. The affected objects are arrays and structures that are 4 KB or larger and are in static or bss storage and also CSECTs (typically COMMON blocks) that are 8 KB or larger. A large COMMON block, equivalence group containing arrays, or structure is aligned on a page boundary, so the alignment of the arrays depends on their position within the containing object. Inside a structure of non-sequence derived type, the compiler adds padding to align large arrays on page boundaries.

struct
The struct option specifies how objects or arrays of a derived type declared using a record structure are stored, and whether or not padding is used between components. All program units must be compiled with the same settings of the -qalign=struct option. The three suboptions available are:

packed
If the packed suboption of the struct option is specified, objects of a derived type are stored with no padding between components, other than any padding represented by %FILL components. The storage format is the same as would result for a sequence structure whose derived type was declared using a standard derived type declaration.

natural
If the natural suboption of the struct option is specified, objects of a derived type are stored with sufficient padding that components will be stored on their natural alignment boundaries, unless storage association requires otherwise. The natural alignment boundaries for objects of a type that appears in the left-hand column of the following table is shown in terms of a multiple of some number of bytes in the corresponding entry in the right-hand column of the table.
Type Natural Alignment (in multiples of bytes)
INTEGER(1), LOGICAL(1), BYTE, CHARACTER 1
INTEGER(2), LOGICAL(2) 2
INTEGER(4), LOGICAL(4), REAL(4) 4
INTEGER(8), LOGICAL(8), REAL(8), COMPLEX(4) 8
REAL(16), COMPLEX(8), COMPLEX(16) 16
Derived Maximum alignment of its components

If the natural suboption of the struct option is specified, arrays of derived type are stored so that each component of each element is stored on its natural alignment boundary, unless storage association requires otherwise.

port

If the port suboption of the struct option is specified,

  • Storage padding is the same as described above for the natural suboption, with the exception that the alignment of components of type complex is the same as the alignment of components of type real of the same kind.
  • The padding for an object that is immediately followed by a union is inserted at the begining of the first map component for each map in that union.

Restrictions:

The port suboption does not affect any arrays or structures with the AUTOMATIC attribute or arrays that are allocated dynamically. Because this option may change the layout of non-sequence derived types, when compiling programs that read or write such objects with unformatted files, use the same setting for this option for all source files.

You must use -qalign=4k if you are using the I/O techniques that are described in Increasing Throughput with Logical Volume I/O and Data Striping.

Related Information:

You can tell if an array has the AUTOMATIC attribute and is thus unaffected by -qalign=4k if you look for the keywords AUTOMATIC or CONTROLLED  AUTOMATIC in the listing of the -qattr Option. This listing also shows the offsets of data objects.

-qarch Option

Syntax:

-qarch=architecture

Controls which instructions the compiler can generate. Changing the default can improve performance but might produce code that can only be run on specific machines.

Arguments:

The choices for architecture are:

auto
Automatically detects the specific architecture of the compiling machine. It assumes that the execution environment will be the same as the compilation environment.

com
You can run the executable file that the compiler generated on any POWER or PowerPC hardware platform, because the file contains only instructions that are common to all machines. This choice is the default if you specify -q32.

If you specify the -q64 option and -qarch=com options together, the target platform is 64-bit. The instruction set will be restricted to those instructions common to all 64-bit machines. See Chapter 6, Using XL Fortran in a 64-bit Environment for details. Also, the rndsngl suboption of the -qfloat option is automatically turned on and cannot be turned off. While this yields better performance on PowerPC systems, you may get slightly different results than if you compile with -qarch=com and -q32.

p2sc
You can run the executable file on any POWER2 Super Chip hardware platform. The POWER2 Super Chip belongs to the -qarch=pwr2 group.

pwr2s
You can run the executable file on any desktop implementation of the POWER2 Chip. This architecture belongs to the -qarch=pwr2 group.

ppc
You can run the executable file on any PowerPC hardware platform, including those that are based on the RS64I, RS64II, RS64III, 601, 603, 604, POWER3, and future PowerPC chips. If you specify the compiler option -q64, the target platform is 64-bit PowerPC. The instruction set is restricted to those common to all 64-bit PowerPC machines. See Chapter 6, Using XL Fortran in a 64-bit Environment for details. This choice is the default if you specify -q64.

The rndsngl suboption of the -qfloat option is automatically turned on and cannot be turned off.

rs64a
You can run the executable file on any RS64I machine. See -qarch=rs64a Option for details.

rs64b
You can run the executable file on any RS64II machine. See -qarch=rs64b Option for details.

rs64c
You can run the executable file on any RS64III machine. See -qarch=rs64c Option for details.

601
You can run the executable file on any PowerPC 601(R) hardware platform. Because the PowerPC 601 processor implements some instructions that are not present in other PowerPC implementations, programs might not run on other PowerPC processors. The rndsngl suboption of the -qfloat option is automatically turned on and cannot be turned off.

603
You can run the executable file on any PowerPC 603(R) hardware platform. Because the PowerPC 603 processor implements some instructions that are not present in other PowerPC implementations, such as the optional PowerPC graphics instructions, programs might not run on other PowerPC processors. The rndsngl suboption of the -qfloat option is automatically turned on and cannot be turned off.

604
You can run the executable file on any PowerPC 604(R) hardware platform. Because the PowerPC 604 processor implements some instructions that are not present in other PowerPC implementations, such as the optional PowerPC graphics instructions, programs might not run on other PowerPC processors. The rndsngl suboption of the -qfloat option is automatically turned on and cannot be turned off.

pwr
You can run the executable file on any POWER or POWER2 hardware platforms. Because executable files for these platforms may contain instructions that are not available on PowerPC systems, they may be incompatible with those newer systems, or they may run more slowly because missing instructions are emulated through software traps.

pwr2

You can run the executable file on any POWER2 hardware platform. Because executable files for these platforms may contain instructions that are not available on POWER and PowerPC (including POWER3) systems, they may be incompatible with those systems.

Note that pwrx is a synonym for pwr2, but pwr2 is preferable.

pwr3

You can run the executable file on any POWER3 hardware platform. Because executable files for these platforms may contain instructions that are not available on POWER, POWER2, or other PowerPC systems, they may be incompatible with those systems.

pwr4
You can run the executable on any POWER4 hardware platform. Use of -qarch=pwr4 will result in binaries that will not run on most previous PowerPC implementations.
Note:
The -qarch setting determines the allowed choices and defaults for the -qtune setting.You can use -qarch and -qtune to target your program to particular machines.

If you intend your program to run only on a particular architecture, you can use the -qarch option to instruct the compiler to generate code specific to that architecture. This allows the compiler to take advantage of machine-specific instructions that can improve performance. The -qarch option provides arguments for you to specify certain chip models; for example, you can specify -qarch=604 to indicate that your program is to be executed on any PowerPC 604 hardware platform.

For a given application program, make sure that you specify the same -qarch setting when you compile each of its source files. Although the linker and loader may detect object files that are compiled with incompatible -qarch settings, you should not rely on it.

You can further enhance the performance of programs intended for specific machines by using the -qcache and -qhot options.

Use these guidelines to help you decide whether to use this option:

Rules:

The PowerPC instruction set includes two optional instruction groups that may be implemented by a particular hardware platform, but are not required. These two groups are the graphics instruction group and the sqrt instruction group. Code compiled with specific -qarch options (all of which refer to specific PowerPC machines) will run on any equivalent PowerPC machine that has an identical instruction group. The following table illustrates the instruction groups that are included for the various PowerPC machines.


Table 15. Instruction groups for PowerPC platforms

Processor Graphics group sqrt group 64-bit
603 yes no no
604 yes no no
rs64a no no yes
rs64b yes yes yes
rs64c yes yes yes
pwr3 yes yes yes
pwr4 yes yes yes

If you compile code using the -qarch=pwr3 option, the code will run on an RS64B hardware platform but will not run on an RS64A platform because the instruction groups are not identical. Similarily, code compiled with the -qarch=603 option will run on a POWER3 machine, but will not run on a RS64A machine.

Related Information:

See Compiling for POWER4, POWER3, POWER2, or PowerPC Systems, -qtune Option, and -qcache Option.

-qassert Option

Syntax:

-qassert={
   deps | nodeps |
   itercnt=n}

Provides information about the characteristics of the files that can help to fine-tune optimizations.

Arguments:

nodeps
Specifies that no loop-carried dependencies exist.

itercnt
Specifies a value for unknown loop iteration counts.

Related Information:

See Cost Model for Loop Transformations for background information and instructions for using these assertions. See also the description of the ASSERT directive in the XL Fortran for AIX Language Reference.

-qattr Option

Syntax:

-qattr[=full] | -qnoattr
ATTR[(FULL)] | NOATTR

Specifies whether to produce the attribute component of the attribute and cross-reference section of the listing.

Arguments:

If you specify only -qattr, only identifiers that are used are reported. If you specify -qattr=full, all identifiers, whether referenced or not, are reported.

If you specify -qattr after -qattr=full, the full attribute listing is still produced.

You can use the attribute listing to help debug problems caused by incorrectly specified attributes or as a reminder of the attributes of each object while writing new code.

Related Information:

See Options That Control Listings and Messages and Attribute and Cross-Reference Section.

-qautodbl Option

Syntax:

-qautodbl=setting
AUTODBL(setting)

Compatibility Benefits

Provides an automatic means of converting single-precision floating-point calculations to double-precision and of converting double-precision calculations to extended-precision.

You might find this option helpful in porting code where storage relationships are significant and different from the XL Fortran defaults. For example, programs that are written for the IBM VS FORTRAN compiler may rely on that compiler's equivalent option.

Performance Benefits

Although the POWER and POWER2 floating-point units perform REAL(4) calculations internally using fast REAL(8) arithmetic, it is often better to have these calculations done entirely using data entities that are REAL(8) or DOUBLE PRECISION. If the calculations are coded using REAL or REAL(4) data entities, the REAL(4)-REAL(8)-REAL(4) conversions take away the extra precision and range and also lessen performance, even though the intermediate calculations are done in IEEE double-precision.

Suboptions

The -qautodbl suboptions offer different strategies to preserve storage relationships between objects that are promoted or padded and those that are not.

The settings you can use are as follows:

none
Does not promote or pad any objects that share storage. This setting is the default.

dbl4
Promotes floating-point objects that are single-precision (4 bytes in size) or that are composed of such objects (for example, COMPLEX or array objects):

This suboption requires the libxlfpmt4.a library during linking.

dbl8
Promotes floating-point objects that are double-precision (8 bytes in size) or that are composed of such objects:

This suboption requires the libxlfpmt8.a library during linking.

dbl
Combines the promotions that dbl4 and dbl8 perform.

This suboption requires the libxlfpmt4.a and libxlfpmt8.a libraries during linking.

dblpad4
Performs the same promotions as dbl4 and pads objects of other types (except CHARACTER) if they could possibly share storage with promoted objects.

This suboption requires the libxlfpmt4.a and libxlfpad.a libraries during linking.

dblpad8
Performs the same promotions as dbl8 and pads objects of other types (except CHARACTER) if they could possibly share storage with promoted objects.

This suboption requires the libxlfpmt8.a and libxlfpad.a libraries during linking.

dblpad
Combines the promotions done by dbl4 and dbl8 and pads objects of other types (except CHARACTER) if they could possibly share storage with promoted objects.

This suboption requires the libxlfpmt4.a, libxlfpmt8.a, and libxlfpad.a libraries during linking.

Linking

If the appropriate -qautodbl option is specified during linking, the program is automatically linked with the necessary extra libraries. Otherwise, you must link them in manually.

Usage

By using dbl4 or dblpad4, you can increase the size of REAL(4) objects without turning REAL(8) objects into REAL(16)s. REAL(16) is less efficient in calculations than REAL(8) is.

The -qautodbl option handles calls to intrinsics with arguments that are promoted; when necessary, the correct higher-precision intrinsic function is substituted. For example, if single-precision items are being promoted, a call in your program to SIN automatically becomes a call to DSIN.

Restrictions:

Related Information:

For background information on promotion, padding, and storage/value relationships and for some source examples, see Implementation Details for -qautodbl Promotion and Padding.

-qrealsize Option describes another option that works like -qautodbl, but it only affects items that are of default kind type and does not do any padding. If you specify both the -qrealsize and the -qautodbl options, only -qautodbl takes effect.

Linking 32-Bit Non-SMP Object Files Using the ld Command explains how to manually link additional libraries with object files that you compiled with -qautodbl.

-qcache Option

Syntax:

-qcache=
{
   assoc=number |
   auto |
   cost=cycles |
   level=level |
   line=bytes |
   size=Kbytes |
   type={C|c|D|d|I|i}
}[:...]

Specifies the cache configuration for a specific execution machine. The compiler uses this information to tune program performance, especially for loop operations that can be structured (or blocked) to process only the amount of data that can fit into the data cache.

If you know exactly what type of system a program is intended to be executed on and that system has its instruction or data cache configured differently from the default case (as governed by the -qtune setting), you can specify the exact characteristics of the cache to allow the compiler to compute more precisely the benefits of particular cache-related optimizations.

For this option to have any effect, you must specify at least level 2 of -O, and you must include the level and type suboptions.

Guidelines

Suboptions

assoc=number
Specifies the set associativity of the cache:

0
Direct-mapped cache

1
Fully associative cache

n > 1
n-way set-associative cache

auto
Automatically detects the specific cache configuration of the compiling machine. It assumes that the execution environment will be the same as the compilation environment.

cost=cycles
Specifies the performance penalty that results from a cache miss so that the compiler can decide whether to perform an optimization that might result in extra cache misses.

level=level
Specifies which level of cache is affected:

1
Basic cache

2
Level-2 cache or the table lookaside buffer (TLB) if the machine has no level-2 cache

3
TLB in a machine that does have a level-2 cache

Other levels are possible but are currently undefined. If a system has more than one level of cache, use a separate -qcache option to describe each level.

line=bytes
Specifies the line size of the cache.

size=Kbytes
Specifies the total size of this cache.

type={C|c| D|d|I|i}
Specifies the type of cache that the settings apply to, as follows:

Restrictions:

If you specify the wrong values for the cache configuration or run the program on a machine with a different configuration, the program may not be as fast as possible but will still work correctly. Remember, if you are not sure of the exact values for cache sizes, use a conservative estimate.

Currently, the -qcache option only has an effect when you also specify the -qhot option.

Examples

To tune performance for a system with a combined instruction and data level-1 cache where the cache is two-way associative, 8 KB in size, and has 64-byte cache lines:

  xlf95 -O3 -qhot -qcache=type=c:level=1:size=8:line=64:assoc=2 file.f

To tune performance for a system with two levels of data cache, use two -qcache options:

  xlf95 -O3 -qhot -qcache=type=D:level=1:size=256:line=256:assoc=4 \
        -qcache=type=D:level=2:size=512:line=256:assoc=2 file.f

To tune performance for a system with two types of cache, again use two -qcache options:

  xlf95 -O3 -qhot -qcache=type=D:level=1:size=256:line=256:assoc=4 \
        -qcache=type=I:level=1:size=512:line=256:assoc=2 file.f

Related Information:

See -qtune Option, -qarch Option, and -qhot Option.

-qcclines Option

Syntax:

-qcclines | -qnocclines
CCLINES |  NOCCLINES

Determines whether the compiler recognizes conditional compilation lines in fixed source form and F90 free source form. IBM free form is not supported.

Defaults

The default is -qcclines if the -qsmp=omp option is turned on; otherwise, the default is -qnocclines.

Related Information:

See the section on conditional compilation in the "Language Elements" chapter of the XL Fortran for AIX Language Reference.

-qcharlen Option

Syntax:

-qcharlen=length
CHARLEN(length)

Obsolete. It is still accepted, but it has no effect. The maximum length for character constants and subobjects of constants is 32 767 bytes (32 KB). The maximum length for character variables is 268 435 456 bytes (256 MB) in 32-bit mode. The maximum length for character variables is 2**40 bytes in 64-bit mode. These limits are always in effect and are intended to be high enough to avoid portability problems with programs that contain long strings.

-qcheck Option

Syntax:

-qcheck | -qnocheck
CHECK | NOCHECK

-qcheck is the long form of the -C Option.

-qci Option

Syntax:

-qci=numbers
CI(numbers)

Specifies the identification numbers (from 1 to 255) of the INCLUDE lines to process. If an INCLUDE line has a number at the end, the file is only included if you specify that number in a -qci option. The set of identification numbers that is recognized is the union of all identification numbers that are specified on all occurrences of the -qci option.

This option allows a kind of conditional compilation because you can put code that is only sometimes needed (such as debugging WRITE statements, additional error-checking code, or XLF-specific code) into separate files and decide for each compilation whether to process them.

Examples

REAL X /1.0/
INCLUDE 'print_all_variables.f' 1
X = 2.5
INCLUDE 'print_all_variables.f' 1
INCLUDE 'test_value_of_x.f' 2
END

In this example, compiling without the -qci option simply declares X and assigns it a value. Compiling with -qci=1 includes two instances of an include file, and compiling with -qci=1:2 includes both include files.

Restrictions:

Because the optional number in INCLUDE lines is not a widespread Fortran feature, using it may restrict the portability of a program.

Related Information:

See the section on the INCLUDE directive in the XL Fortran for AIX Language Reference.

-qcompact Option

Syntax:

-qcompact | -qnocompact
COMPACT | NOCOMPACT

Reduces optimizations that increase code size.

By default, some techniques the optimizer uses to improve performance may also make the program larger. For systems with limited storage, you can use -qcompact to reduce the expansion that takes place.

Rules:

With -qcompact in effect, -Q and other optimization options still work; the reductions in code size come from limiting code replication that is done automatically during optimization.

-qctyplss Option

Syntax:

-qctyplss[(=[no]arg)] | -qnoctyplss
CTYPLSS[([NO]ARG)]| NOCTYPLSS
 

Specifies whether character constant expressions are allowed wherever typeless constants may be used. This language extension might be needed when you are porting programs from other platforms.

Arguments:

arg | noarg
Suboptions retain the behavior of -qctyplss. Additionally, arg specifies that Hollerith constants used as actual arguments will be treated as integer actual arguments.

Rules:

With -qctyplss, character constant expressions are treated as if they were Hollerith constants and thus can be used in logical and arithmetic expressions.

Restrictions:

Examples

Example 1: In the following example, the compiler option -qctyplss allows the use of a character constant expression.

@PROCESS CTYPLSS
      INTEGER I,J
      INTEGER, PARAMETER :: K(1) = (/97/)
      CHARACTER, PARAMETER :: C(1) = (/'A'/)
 
      I = 4HABCD          ! Hollerith constant
      J = 'ABCD'          ! I and J have the same bit representation
 
! These calls are to routines in other languages.
      CALL SUB(%VAL('A')) ! Equivalent to CALL SUB(97)
      CALL SUB(%VAL(1HA)) ! Equivalent to CALL SUB(1627389952)"
 
! These statements are not allowed because of the constant-array
! restriction.
!     I = C // C
!     I = C(1)
!     I = CHAR(K(1))
      END

Example 2: In the following example, the variable J is passed by reference. The suboption arg specifies that the Hollerith constant is passed as if it were an integer actual argument.

@PROCESS CTYPLSS(ARG)
      INTEGER :: J
 
      J = 3HIBM
! These calls are to routines in other languages.
      CALL SUB(J)
      CALL SUB(3HIBM)   ! The Hollerith constant is passed as if
                        ! it were an integer actual argument
 

Related Information:

See "Hollerith Constants" in the XL Fortran for AIX Language Reference and Passing Arguments By Reference or By Value.

-qdbg Option

Syntax:

-qdbg | -qnodbg
DBG | NODBG

-qdbg is the long form of the -g Option.

-qddim Option

Syntax:

-qddim | -qnoddim
DDIM | NODDIM

Specifies that the bounds of pointee arrays are re-evaluated each time the arrays are referenced and removes some restrictions on the bounds expressions for pointee arrays.

Rules:

By default, a pointee array can only have dimension declarators containing variable names if the array appears in a subprogram, and any variables in the dimension declarators must be dummy arguments, members of a common block, or use- or host-associated. The size of the dimension is evaluated on entry to the subprogram and remains constant during execution of the subprogram.

With the -qddim option:

Examples

@PROCESS DDIM
INTEGER PTE, N, ARRAY(10)
POINTER (P, PTE(N))
N = 5
P = LOC(ARRAY(2))
PRINT *, PTE   ! Print elements 2 through 6.
ARRAY
N = 7          ! Increase the size.
PRINT *, PTE   ! Print elements 2 through 8.
ARRAY
END

-qdirective Option

Syntax:

-qdirective[=directive_list] | -qnodirective[=directive_list]
DIRECTIVE[(directive_list)] | NODIRECTIVE[(directive_list)]

Specifies sequences of characters, known as trigger constants, that identify comment lines as compiler comment directives.

Background Information:

A directive is a line that is not a Fortran statement but is recognized and acted on by the compiler. The compiler always recognizes some directives, such as @PROCESS. To allow you maximum flexibility, any new directives that might be provided with the XL Fortran for AIX compiler in the future will be placed inside comment lines. This avoids portability problems if other compilers do not recognize the directives.

Defaults

The compiler recognizes the default trigger constant IBM*. Specification of -qsmp implies -qdirective=smp\$:\$omp:ibmp, and, by default, the trigger constants SMP$, $OMP, and IBMP are also turned on. If you specify -qsmp=omp, the compiler ignores all trigger constants that you have specified up to that point and recognizes only the $OMP trigger constant. Specification of -qthreaded implies -qdirective=ibmt, and, by default, the trigger constant IBMT is also turned on.

Arguments:

The -qnodirective option with no directive_list turns off all previously specified directive identifiers; with a directive_list, it turns off only the selected identifiers.

-qdirective with no directive_list turns on the default trigger constant IBM* if it has been turned off by a previous -qnodirective.

Notes:

Examples

@PROCESS FREE
PROGRAM DIRECTV
INTEGER A, B, C, D, E, F
A = 1 ! Begin in free form.
B = 2
!OLDSTYLE SOURCEFORM(FIXED)
! Switch to fixed form for this include file that has not
! been converted yet.
      INCLUDE 'set_c_and_d.inc'
!IBM* SOURCEFORM(FREE)
E = 5 ! Back to free form.
F = 6
END

For this example, compile with the option -qdirective=oldstyle to ensure that the compiler recognizes the SOURCEFORM directive before the INCLUDE line. After converting the include file to use free form, you can compile with the -qnodirective option, and the SOURCEFORM(FIXED) directive is ignored.

Related Information:

See the section on the SOURCEFORM directive in the XL Fortran for AIX Language Reference.

As the use of incorrect trigger constants can generate warning messages or error messages or both, you should check the particular directive statement in the "Directives" chapter of the XL Fortran for AIX Language Reference for the suitable associated trigger constant.

-qdlines Option

Syntax:

-qdlines | -qnodlines
DLINES | NODLINES

-qdlines is the long form of the -D Option.

-qdpc Option

Syntax:

-qdpc[=e] | -qnodpc
DPC[(E)] | NODPC

Increases the precision of real constants, for maximum accuracy when assigning real constants to DOUBLE PRECISION variables. This language extension might be needed when you are porting programs from other platforms.

Rules:

If you specify -qdpc, all basic real constants (for example, 1.1) are treated as double-precision constants; the compiler preserves some digits of precision that would otherwise be lost during the assignment to the DOUBLE PRECISION variable. If you specify -qdpc=e, all single-precision constants, including constants with an e exponent, are treated as double-precision constants.

This option does not affect constants with a kind type parameter specified.

Examples

@process nodpc
        subroutine nodpc
        real x
        double precision y
        data x /1.000000000001/  ! The trailing digit is lost
        data y /1.000000000001/  ! The trailing digit is lost
 
        print *, x, y, x .eq. y  ! So x is considered equal to y
        end
 
@process dpc
        subroutine dpc
        real x
        double precision y
        data x /1.000000000001/  ! The trailing digit is lost
        data y /1.000000000001/  ! The trailing digit is preserved
 
        print *, x, y, x .eq. y  ! So x and y are considered different
        end
 
        program testdpc
        call nodpc
        call dpc
        end

When compiled, this program prints the following:

   1.000000000       1.00000000000000000     T
   1.000000000       1.00000000000100009     F

showing that with -qdpc the extra precision is preserved.

Related Information:

-qautodbl Option and -qrealsize Option are more general-purpose options that can also do what -qdpc does. -qdpc has no effect if you specify either of these options.

-qdpcl Option

Syntax:

-qdpcl | -qnodpcl
DPCL | NODPCL

Generates symbols that tools based on the Dynamic Probe Class Library (DPCL) can use to see the structure of an executable file.

When you specify the -qdpcl option, the compiler emits symbols to define blocks of code in a program. You can then use tools that use the DPCL interface to examine performance information, such as memory usage, for object files that you compiled with this option.

Restrictions:

You must also specify the -g option when you specify -qdpcl.

-qescape Option

Syntax:

-qescape | -qnoescape
ESCAPE | NOESCAPE

Specifies how the backslash is treated in character strings, Hollerith constants, H edit descriptors, and character string edit descriptors. It can be treated as an escape character or as a backslash character. This language extension might be needed when you are porting programs from other platforms.

Defaults

By default, the backslash is interpreted as an escape character in these contexts. If you specify -qnoescape, the backslash is treated as the backslash character.

The default setting is useful for the following:

If you are writing or porting code that depends on backslash characters being passed through unchanged, specify -qnoescape so that they do not get any special interpretation. You could also write \\ to mean a single backslash character under the default setting.

Examples


$ # Demonstrate how backslashes can affect the output
$ cat escape.f
       PRINT *,'a\bcde\fg'
       END
$ xlf95 escape.f
** _main === End of Compilation 1 ===
1501-510  Compilation successful for file escape.f.
$ a.out
cde
    g
$ xlf95 -qnoescape escape.f
** _main === End of Compilation 1 ===
1501-510  Compilation successful for file escape.f.
 $ a.out
  a\bcde\fg  

In the first compilation, with the default setting of -qescape, \b is printed as a backspace, and \f is printed as a formfeed character. With the -qnoescape option specified, the backslashes are printed like any other character.

Related Information:

The list of escape sequences that XL Fortran recognizes is shown in Table 25.

-qessl Option

Syntax:

-qessl | -qnoessl

Allows the use of ESSL routines in place of Fortran 90 intrinsic procedures.

The Engineering and Scientific Subroutine Library (ESSL) is a collection of subroutines that provides a wide range of mathematical functions for various scientific and engineering applications. The subroutines are tuned for performance on the RS/6000(R) workstations. Some of the Fortran 90 intrinsic procedures have similar counterparts in ESSL. Performance is improved when these Fortran 90 intrinsic procedures are linked with ESSL. In this case, you can keep the interface of Fortran 90 intrinsic procedures, and get the added benefit of improved performance using ESSL.

Rules:

Use the ESSL Serial Library when linking with -lessl. Use the ESSL SMP Library when linking with -lesslsmp.

Either -lessl or -lesslsmp must be used whenever code is being compiled with -qessl. ESSL v3.1.2 or above is recommended. It supports both 32-bit and 64-bit environments.

One or more of the following performance optimization features must also be enabled before the -qessl option will take effect:

The following MATMUL function calls may use ESSL routines when -qessl is enabled:

 real a(10,10), b(10,10), c(10,10)
   c=MATMUL(a,b)
 

Examples

Related Information:

The ESSL libraries are not shipped with the XL Fortran compiler. For more information on these two libraries, see the Engineering and Scientific Subroutine Library for AIX Guide and Reference.

-qextchk Option

Syntax:

-qextchk | -qnoextchk
EXTCHK | NOEXTCHK

Sets up type-checking information for common blocks, procedure definitions, procedure references, and module data. Later, the linker can detect mismatches across compilation units by using this information.

Rules:

At compile time, -qextchk verifies the consistency of procedure definitions and references and module data.

At link time, -qextchk verifies that actual arguments agree in type, shape, passing mode, and class with the corresponding dummy arguments and that declarations of common blocks and modules are consistent.

-qextern Option

Syntax:

-qextern=names

Allows user-written procedures to be called instead of XL Fortran intrinsics. names is a list of procedure names separated by colons. The procedure names are treated as if they appear in an EXTERNAL statement in each compilation unit being compiled. If any of your procedure names conflict with XL Fortran intrinsic procedures, use this option to call the procedures in the source code instead of the intrinsic ones.

Arguments:

Separate the procedure names with colons.

Applicable Product Levels:

Because of the many Fortran 90 and Fortran 95 intrinsic functions and subroutines, you might need to use this option even if you did not need it for FORTRAN 77 programs.

Examples

      SUBROUTINE GETENV(VAR)
         CHARACTER(10) VAR
         PRINT *,VAR
      END
 
      CALL GETENV('USER')
      END

Compiling this program with no options fails because the call to GETENV is actually calling the intrinsic subroutine, not the subroutine defined in the program. Compiling with -qextern=getenv allows the program to be compiled and run successfully.

-qextname Option

Syntax:

-qextname | -qnoextname
EXTNAME | NOEXTNAME

Adds an underscore to the names of global entities, which helps in porting programs from systems where this is a convention for mixed-language programs.

The name of a main program is not affected.

The -qextname option helps to port mixed-language programs to XL Fortran without modifications. Use of this option avoids naming problems that might otherwise be caused by:

If your program has only a few instances of the naming problems that -qextname solves, you may prefer to select new names with the -brename option of the ld command.

Restrictions:

You must compile all the source files for a program, including the source files of any required module files, with the same -qextname setting.

Examples

@PROCESS EXTNAME
        SUBROUTINE STORE_DATA
        CALL FLUSH(10)  ! Using EXTNAME, we can drop the final underscore.
        END SUBROUTINE

Special Note

If you use the xlfutility module to ensure that the Service and Utility subprograms are correctly declared, you must change the name to xlfutility_extname when compiling with -qextname.

Related Information:

This option also affects the names that are specified in several other options, so you do not have to include underscores in their names on the command line. The affected options are -qextern Option, -Q Option, and -qsigtrap Option.

-qfdpr Option

Syntax:

 -qfdpr | -qnofdpr

Provides object files with information that the AIX Feedback Directed Program Restructuring (fdpr) performance-tuning utility needs to optimize the resulting executable file.

Restrictions:

The fdpr performance-tuning utility has its own set of restrictions, and it is not guaranteed to speed up all programs or produce executables that produce exactly the same results as the original programs.

If you use the -qfdpr compiler option, only those object files that are built with this flag will be reordered. Therefore, if you use -qfdpr, you should use it for all object files in a program. Static linking will not improve performance if you use the -qfdpr compiler option.

When you use -qfdpr on some of the objects that are built into an executable, fdpr will only perform some optimizations on the objects that are built with fdpr. This can mean that fdpr has less benefit on programs compiled using -qfdpr, because library code is not optimized (since it has not been compiled with -qfdpr).

The optimizations that the fdpr command performs are similar to those that the -qpdf option performs.

Related Information:

For more information, see the fdpr man page and the AIX Commands Reference.

-qfixed Option

Syntax:

-qfixed[=right_margin]
FIXED[(right_margin)]

Indicates that the input source program is in fixed form and optionally specifies the maximum line length.

The source form specified when executing the compiler applies to all of the input files, although you can switch the form for a compilation unit by using a FREE or FIXED @PROCESS directive or switch the form for the rest of the file by using a SOURCEFORM comment directive (even inside a compilation unit).

For source code from some other systems, you may find you need to specify a right margin larger than the default. This option allows a maximum right margin of 132.

Defaults

-qfixed=72 is the default for the xlf, xlf_r, xlf_r7, fort77 and f77 commands. -qfree=f90 is the default for the xlf90, xlf90_r, xlf90_r7, xlf95, xlf95_r, and xlf95_r7 commands.

Related Information:

See -qfree Option.

For the precise specifications of this source form, see "Fixed Source Form" in the XL Fortran for AIX Language Reference.

-qflag Option

Syntax:

-qflag=listing_severity:terminal_severity
FLAG(listing_severity,terminal_severity)

You must specify both listing_severity and terminal_severity.

Limits the diagnostic messages to those of a specified level or higher. Only messages with severity listing_severity or higher are written to the listing file. Only messages with severity terminal_severity or higher are written to the terminal. -w is a short form for -qflag=e:e.

Arguments:

The severity levels (from lowest to highest) are:

i
Informational messages. They explain things that you should know, but they usually do not require any action on your part.

l
Language-level messages, such as those produced under the -qlanglvl option. They indicate possible nonportable language constructs.

w
Warning messages. They indicate error conditions that might require action on your part, but the program is still correct.

e
Error messages. They indicate error conditions that require action on your part to make the program correct, but the resulting program can probably still be executed.

s
Severe error messages. They indicate error conditions that require action on your part to make the program correct, and the resulting program will fail if it reaches the location of the error. You must change the -qhalt setting to make the compiler produce an object file when it encounters this kind of error.

u
Unrecoverable error messages. They indicate error conditions that prevent the compiler from continuing. They require action on your part before you can compile your program.

The -qflag option overrides any -qlanglvl or -qsaa options specified.

Defaults

The default for this option is i:i so that you do not miss any important informational messages.

Related Information:

See -qlanglvl Option and Understanding XL Fortran Error Messages.

-qfloat Option

Syntax:

-qfloat=options
FLOAT(options)

Selects different strategies for speeding up or improving the accuracy of floating-point calculations.

This option replaces several separate options. For any new code, you should use it instead of -qfold, -qmaf, or related options.

You should be familiar with the information in Chapter 7, XL Fortran Floating-Point Processing and the IEEE standard before attempting to change any -qfloat settings.

Defaults

The default setting uses the suboptions nofltint, fold, nohsflt, nohssngl, maf, nonans, norndsngl, norrm, norsqrt, and nostrictnmaf. Some options change this default, as explained below.

The default setting of each suboption remains in effect unless you explicitly change it. For example, if you select -qfloat=nofold, the settings for nohsflt, nohssngl, or related options are not affected.

Arguments:

The available suboptions each have a positive and negative form, such as fold and nofold, where the negative form is the opposite of the positive.

The suboptions are as follows:

fltint | nofltint
Speeds up calculations more safely than the hsflt suboption, by rounding double-precision values only when they are stored into REAL(4) memory locations.
Note:
If a program converts a floating-point value that is outside the representable range of integers, it produces undefined results because the error condition is not detected.

Although this suboption is turned off by default, it is turned on by the -O3 optimization level unless you also specify -qstrict.

fold | nofold
Evaluates constant floating-point expressions at compile time, which may yield slightly different results from evaluating them at run time. The compiler always evaluates constant expressions in specification statements, even if you specify nofold.

hsflt | nohsflt
Speeds up calculations by preventing rounding for single-precision expressions and by replacing floating-point division by multiplication with the reciprocal of the divisor. It also uses the same technique as the fltint suboption for floating-point-to-integer conversions.
Note:
This suboption is intended for specific applications in which floating-point calculations have known characteristics. In particular, all floating-point results must be within the defined range of representation of single precision. The use of this option when compiling other application programs may produce incorrect results without warning. See Technical Details of the -qfloat=hsflt Option for details.

hssngl | nohssngl
Speeds up calculations in a safer way than hsflt, by rounding single-precision expressions only when the results are stored into REAL(4) memory locations.

maf | nomaf
Makes floating-point calculations faster and more accurate by using multiply-add instructions where appropriate. The possible disadvantage is that results may not be exactly equivalent to those from similar calculations that are performed at compile time or on other types of computers.

nans | nonans
Detects (at run time) operations that involve signaling NaN values (NaNS), so that you can use -qflttrap=invalid:enable to deal with exception conditions that involve signaling NaNS. Use this suboption only if your program explicitly creates NaNS values, because these values never result from other floating-point operations.

rndsngl | norndsngl
Rounds the result of each single-precision (REAL(4)) operation to single-precision, rather than waiting until the full expression is evaluated. It sacrifices speed for consistency with results from similar calculations on other types of computers.

This setting is always in effect for programs that you compile with any of the -qarch PowerPC suboptions, because of the way the PowerPC floating-point unit works. The rndsngl suboption is also turned on if you specify -q64 and -qarch=com together.

rrm | norrm
Turns off compiler optimizations that require the rounding mode to be the default, round-to-nearest, at run time. Use this option if your program changes the rounding mode by any means, such as by calling the fpsets procedure. Otherwise, the program may compute incorrect results.

rsqrt | norsqrt
Speeds up some calculations by replacing division by the result of a square root with multiplication by the reciprocal of the square root.

Although this suboption is turned off by default, specifying -O3 turns it on unless you also specify -qstrict.

strictnmaf | nostrictnmaf
Turns off floating-point transformations that are used to introduce negative MAF instructions, as these transformations do not preserve the sign of a zero value. By default, the compiler enables these types of transformations.

To ensure strict semantics, specify both -qstrict and -qfloat=strictnmaf.

-qflttrap Option

Syntax:

-qflttrap[=suboptions] | -qnoflttrap
FLTTRAP[(suboptions)] | NOFLTTRAP

Determines what types of floating-point exception conditions to detect at run time. The program receives a SIGTRAP signal when the corresponding exception occurs.

Arguments:

OVerflow
Detect and trap on floating-point overflow if exception-checking is enabled.

UNDerflow
Detect and trap on floating-point underflow if exception-checking is enabled.

ZEROdivide
Detect and trap on floating-point division by zero if exception-checking is enabled.

INValid
Detect and trap on floating-point invalid operations if exception-checking is enabled.

INEXact
Detect and trap on floating-point inexact if exception-checking is enabled. Because inexact results are very common in floating-point calculations, you usually should not need to turn this type of exception on.

ENable
Turn on checking for the specified exceptions in the main program so that the exceptions generate SIGTRAP signals. You must specify this suboption if you want to turn on exception trapping without modifying your source code.

IMPrecise
Only check for the specified exceptions on subprogram entry and exit. This suboption improves performance, but it can make the exact spot of the exception difficult to find.

Defaults

The -qflttrap option without suboptions is equivalent to -qflttrap=ov:und:zero:inv:inex. However, because this default does not include enable, it is probably only useful if you already use fpsets or similar subroutines in your source. If you specify -qflttrap more than once, both with and without suboptions, the -qflttrap without suboptions is ignored.

Restrictions:

On AIX Version 4.3.3 and above, if you use -qflttrap=inv:en to compile a program containing an IEEE invalid SQRT operation and then run that program, the expected SIGTRAP signal may not occur on PowerPC machines and does not occur at all on POWER machines.

You can only fix this problem for AIX Version 4.3.3 and subsequent levels of the operating system. Specify the following command:

     export SQRT_EXCEPTION=3.1

Examples

When you compile this program:

        REAL X, Y, Z
        DATA X /5.0/, Y /0.0/
        Z = X / Y
        END

with the command:

xlf95 -qflttrap=zerodivide:enable -qsigtrap divide_by_zero.f

the program stops when the division is performed.

The zerodivide suboption identifies the type of exception to guard against. The enable suboption causes a SIGTRAP signal when the exception occurs. The -qsigtrap option produces informative output when the signal stops the program.

Related Information:

See -qsigtrap Option.

See Detecting and Trapping Floating-Point Exceptions for full instructions on how and when to use the -qflttrap option, especially if you are just starting to use it.

-qfree Option

Syntax:

-qfree[={f90|ibm}]
FREE[({F90|IBM})]

Indicates that the source code is in free form. The ibm and f90 suboptions specify compatibility with the free form defined for VS FORTRAN and Fortran 90, respectively. Note that the free form defined for Fortran 90 also applies to Fortran 95.

The source form specified when executing the compiler applies to all of the input files, although you can switch the form for a compilation unit by using a FREE or FIXED @PROCESS directive or for the rest of the file by using a SOURCEFORM comment directive (even inside a compilation unit).

Defaults

-qfree by itself specifies Fortran 90 free form.

-qfixed=72 is the default for the xlf, xlf_r, xlf_r7, and f77 commands. -qfree=f90 is the default for the xlf90, xlf90_r, xlf90_r7, xlf95, xlf95_r, and xlf95_r7 commands.

Related Information:

See -qfixed Option.

-k is equivalent to -qfree=f90.

Fortran 90 free form is explained in "IBM Free Form" in the XL Fortran for AIX Language Reference. It is the format to use for maximum portability across compilers that support Fortran 90 and Fortran 95 features now and in the future.

IBM free form is equivalent to the free format of the IBM VS FORTRAN compiler, and it is intended to help port programs from the System/370(TM) platform. It is explained in "IBM Free Source Form" in the XL Fortran for AIX Language Reference.

-qfullpath Option

Syntax:

-qfullpath | -qnofullpath

Records the full, or absolute, path names of source and include files in object files compiled with debugging information (-g option).

If you need to move an executable file into a different directory before debugging it or have multiple versions of the source files and want to ensure that the debugger uses the original source files, use the -qfullpath option in combination with the -g option so that source-level debuggers can locate the correct source files.

Defaults

By default, the compiler records the relative path names of the original source file in each .o file. It may also record relative path names for include files.

Restrictions:

Although -qfullpath works without the -g option, you cannot do source-level debugging unless you also specify the -g option.

Examples

In this example, the executable file is moved after being created, but the debugger can still locate the original source files:


$ xlf95 -g -qfullpath file1.f file2.f file3.f -o debug_version
...
$ mv debug_version $HOME/test_bucket
$ cd $HOME/test_bucket
$ xldb debug_version

Related Information:

See -g Option.

-qhalt Option

Syntax:

-qhalt=severity
HALT(severity)

Stops before producing any object, executable, or assembler source files if the maximum severity of compile-time messages equals or exceeds the specified severity. severity is one of i, l, w, e, s, u, or q, meaning informational, language, warning, error, severe error, unrecoverable error, or a severity indicating "don't stop".

Arguments:

The severity levels (from lowest to highest) are:

i
Informational messages. They explain things that you should know, but they usually do not require any action on your part.

l