Fortran User's Guide HomeContentsPreviousNextIndex


Chapter 3

f77/f95 Compiler Options

This chapter details the command-line options for the Sun WorkShop f77 and f95 compilers.

Some options are not available on both compilers (f77 or f95). Check the reference section for availability.      

Command Syntax

The general syntax of the compiler command line is:

f77 [options] list_of_files  additional_options
f95 [options] list_of_files  additional_options

Items in square brackets indicate optional parameters. The brackets are not part of the command. The options are a list of option keywords prefixed by dash (-). Some keyword options take the next item in the list as an argument. The list_of_files is a list of source, object, or library file names separated by blanks. Also, there are some options that must appear after the list of source files, and these could include additional lists of files (for example, -B, -l, and -L).

Options Syntax

Typical compiler option formats are:

TABLE 3-1   Options Syntax
Syntax Format Example
-flag
-g
-flagvalue
-Dnostep
-flag=value
-xunroll=4
-flag value
-o outfile


The following typographical conventions are used when describing the individual options:

TABLE 3-2   Typographic Notations for Options  
Notation Meaning Example: Text/Instance
    [ ] Square brackets contain arguments that are optional.
 -O[n]
 -O4, -O
    { } Curly brackets contain a set of choices for a required option.
 -d{y|n}
 -dy
    | The "pipe" or "bar" symbol separates arguments, only one of which may be chosen.
 -B{dynamic|static}
 -Bstatic
    : The colon, like the comma, is sometimes used to separate arguments.
 -Rdir[:dir]
 -R/local/libs:/U/a
    ... The ellipsis indicates omission in a series.
 -xinline=f1[,...fn]
 -xinline=alpha,dos


Brackets, pipe, and ellipsis are meta characters used in the descriptions of the options and are not part of the options themselves.

Some general guidelines for options are:

Source files, object files, and libraries are compiled and linked in the order in which they appear on the command line.

Options Summary

In this section, the compiler options are grouped by function to provide an easy reference. The details will be found on the pages in the following sections, as indicated.

The following table summarizes the f77 and f95 compiler options by functionality. The table does not include obsolete and legacy option flags. Some flags serve more than one purpose and appear more than once.

TABLE 3-3   Compiler Options Grouped by Functionality  
Function Option Flag
Compilation Mode:

Compile only; do not produce an executable file
-c

Show commands built by the driver but do not compile
-dryrun

Specify name of object, library, or executable file to write
-o filename

Compile and generate only assembly code
-S

Strip symbol table from executable
-s

Suppress compiler messages, except error messages
-silent

Define path to directory for temporary files
-temp=directory

Show elapsed time for each compilation phase
-time

Show version number of compiler and its phases
-V

Verbose messages
-v
Compiled Code:

Add/supress trailing underscores on external names
-ext_names=x

Inline specified user functions
-inline=list

Compile position independent code
-KPIC/-kpic

Inline certain math library routines
-libmil

STOP returns integer status value to shell
-stop_status[=yn]

Specify code address space
-xcode=x

Enable UltraSPARC prefetch instructions
-xprefetch[=x]

Specify use of optional registers
-xregs=x

Specify default data mappings
-xtypemap=x
Data Alignment:

Specify alignment of data in COMMON blocks
-aligncommon[=n]

Force COMMON block data alignment to allow double word fetch/store
-dalign

Force alignment of all data on 8-byte boundaries
-dbl_align_all

Align COMMON block data on 8-byte boundaries
-f

Specify memory alignment and behavior
-xmemalign[=ab]
Debugging:

Enable runtime subscript range checking
-C

Compile for debugging
-g

Compile for browsing with Sun WorkShop source browser
-sb, -sbfast

Flag use of undeclared variables
-u

Compile for Sun WorkShop Performance Analyzer
-xF

Generate source listings
-Xlistx

Enable debugging without object files
-xs

Compile for looptool profiling
-Zlp
Diagnostics:

Flag use of non-standard extensions
-ansi

Suppress specific error messages
-erroff=list

Display error tag names with error messages
-errtags

Show summary of compiler options
-flags, -help

Show version number of the compiler and its phases
-V

Verbose messages
-v

Verbose parallelization messages
-vpara

Show/suppress warning messages
-wn

Enable runtime task common check
-xcommonchk

Display compiler README file
-xhelp=readme
Licensing:

Show license server information
-xlicinfo
Linking and Libraries:

Allow/require dynamic/static libraries
-Bx

Allow only dynamic/static library linking
-dy, -dn

Build a dynamic (shared object) library
-G

Assign name to dynamic library
-hname

Add directory to library search path
-Ldir

Link with library libname.a or libname.so
-lname

Build runtime library search path into executable
-Rdir

Disable use of incremental linker, ild
-xildoff

Link with optimized math library
-xlibmopt

Link with Sun Performance Library
-xlic_lib=sunperf

Link editor option
-zx

Generate pure libraries with no relocations
-ztext
Numerics and Floating-Point:

Use non-standard floating-point preferences
-fnonstd

Select SPARC non-standard floating point
-fns

Enable runtime floating-point overflow during input
-fpover

Select IEEE floating-point rounding mode
-fpround=r

Select floating-point optimization level
-fsimple=n

Select floating-point trapping mode
-ftrap=t

Promote single precision constants to double precision
-r8const

Enable interval arithmetic and set the appropriate floating-point environment (includes -xinterval)
-xia[=e]

Enable interval arithmetic extensions
-xinterval[=e]
Optimization and Performance:

Analyze loops for data dependencies
-depend

Optimize using a selection of options
-fast

Specify optimization level
-On

Pad data layout for efficient use of cache
-pad[=p]

Allocate local variables on the memory stack
-stackvar

Enable loop unrolling
-unroll[=m]

Enable optimization across source files
-xcrossfile[=n]

Set highest optimization level for #pragma OPT
-xmaxopt[=n]

Assert that no memory-based traps will occur
-xsafe=mem

Do no optimizations that increase code size
-xspace

Generate calls to vector library functions automatically
-xvector[=yn]
Parallelization:
(Note: Fortran parallelization features require a Sun WorkShop HPC license).

Enable automatic parallelization of DO loops
-autopar

Enable parallelization of loops explicitly marked with directives
-explicitpar

Show loop parallelization information
-loopinfo

Specify which style of directives to accept: Sun, Cray, OpenMP
-mp=v

Compile for hand-coded multithreaded programming
-mt

Accept OpenMP API directives and set appropriate environment (macro)
-openmp

Parallelize loops with -autopar -explicitpar -depend combination
-parallel

Recognize reduction operations in loops with automatic parallelization
-reduction

Verbose parallelization messages
-vpara
Source Code:

Define preprocessor symbol
-Dname[=sym]

Accept extended (132 character) source lines
-e

Apply preprocessor to .F and/or .F90 and .F95 files but do not compile
-F

Accept fixed-format input (f95)
-fixed

Preprocess all source files with the fpp preprocessor
-fpp

Accept free-format input (f95)
-free

Add directory to include file search path
-Idir

Add directory to module search path
-Mdir

Recognize upper and lower case as distinct
-U

Select preprocessor, cpp or fpp, to use
-xpp[={fpp|cpp}]

Allow recursive subprogram calls
-xrecursive
Target Platform:

Optimize for the host system
-native

Specify target platform instruction set for the optimizer
-xarch=a

Specify target cache properties for optimizer
-xcache=a

Specify target processor for the optimizer
-xchip=a

Specify target platform for the optimizer
-xtarget=a


Commonly Used Options

The Sun Fortran compilers have many features that are selectable by optional command-line parameters. The short list below of commonly used options is a good place to start.          

TABLE 3-4   Commonly Used Options  
Action Option
Debug--global program checking across routines for consistency of arguments, commons, and so on.
-Xlist
Debug--produce additional symbol table information to enable the dbx and Sun WorkShop debugging.
-g
Performance--invoke the optimizer to produce faster running programs.
-O[n]
Performance--Produce efficient compilation and run times for the native platform, using a set of predetermined options.
-fast
Dynamic (-Bdynamic) or static (-Bstatic) library binding.
-Bx
Compile only--Suppress linking; make a .o file for each source file.
-c
Output file--Name the executable output file nm instead of a.out.
-o nm
Source code--Compile fixed format Fortran 77 code with f95.
-fixed


Backward Compatibility and Legacy Options

The following options are provided for backward compatibility with earlier compiler releases, and certain Fortran legacy capabilities.

TABLE 3-5   Backward Compatibility Options  
Action Option
Double default data sizes: use -xtypemap instead.
-r8 or  -dbl
Allow assignment to constant arguments.
-copyargs
External names--make external names without underscores.
-ext_names=e
Nonstandard arithmetic--allow nonstandard arithmetic.
-fnonstd
Optimize performance for the host system.
-native
Output--use old style list-directed output.
-oldldo
DO loops--use one trip DO loops.
-onetrip
Compile for SPARC V7 architecture
-cg89
Compile for SPARC V8 architecture
-cg92


Use of these option flags is not recommended and should be avoided.

Obsolescent Options

The following options are no longer supported by the f77 and f95 compilers. Their appearance on a compiler command does not cause an error, and no action is taken; they are ignored.

TABLE 3-6   Obsolescent Options 
Original Intention Option
Compile for Thread Analyzer
-Ztha
Disable exception traps (f95)
-fnonstop


Options Reference

This section shows all f77 and f95 compiler command-line option flags, including various risks, restrictions, caveats, interactions, examples, and other details. Each description indicates platform availability of the option.

Legend Option Availablity
f77
only available with f77
f95
only available with f95
f77/f95
available with both f77 and f95


Options that are not available for a compiler on a particular platform will still be accepted silently by the compiler. That is, the compiler will accept the option on the command-line on that platform without issuing a warning, but the option does nothing.


-a

Profile by basic block using tcov, old style.

This is the old style of basic block profiling for tcov. See -xprofile=tcov for information on the new style of profiling and the tcov(1) man page for more details. Also see the manual, Analyzing Program Performance with Sun WorkShop.

Insert code to count the times each basic block of statements is executed. This invokes a runtime recording mechanism that creates one .d file for every .f file at normal program termination. The .d file accumulates execution data for the corresponding source file. The tcov(1) utility can then be run on the source file(s) to generate statistics about the program. The summary output produced by tcov is written to file.tcov for each source file. -pg and gprof are complementary to -a and tcov.

If set at compile-time, the TCOVDIR environment variable specifies the directory where the .d and .tcov files are located. If this variable is not set, then the .d files remain in the same directory as the .f files.

The -xprofile=tcov and the -a options are compatible in a single executable. That is, you can link a program that contains some files which have been compiled with -xprofile=tcov, and others with -a. You cannot compile a single file with both options.

If you compile and link in separate steps, and you compile with -a, then be sure to link with -a.

For details, see the chapter Performance Profiling in the Fortran Programming Guide.


-aligncommon[=n]

Specify the alignment of data in COMMON blocks.

n may be 1, 2, 4, 8, or 16, and indicates the desired alignment size (in bytes) of data elements within COMMON blocks.

For example, -aligncommon=4 would align all common block data elements of size 4 bytes or more on 4-byte boundaries. Data in blocks smaller than the specified size are not affected by this option and are aligned on their respective natural boundaries.

When -aligncommon is not specified, common block data is aligned by default on (at most) 4-byte boundaries.

Specifying -aligncommon without a value defaults to 1 on all platforms: all common block data aligns on byte boundaries (no padding between elements).


-ansi

Identify many nonstandard extensions.

Warning messages are issued for any uses of non-standard Fortran 77 or Fortran 95 extensions in the source code.


-arg=local

Preserve actual arguments over ENTRY statements.

When you compile a subprogram with alternate entry points with this option, f77 uses copy restore to preserve the association of dummy and actual arguments. For example, the following program would require compilation with -arg=local to insure proper execution:

         A = SETUP(ALPHA,BETA,GAMMA)
         ZORK = FXGAMMA(GCONST)
         ...
         FUNCTION SETUP(A1,A2,A3)
         ...
         ENTRY FXGAMMA(F)
         FXGAMMA = F*GAMMA
         ...
         RETURN
         END

Without this option, there is no guarantee that the correct values of the actual arguments from the SETUP call will be referenced when the routine is entered through FXGAMMA. Code that relies on -arg=local is nonstandard.


autopar

Enable automatic loop parallelization. (Requires a Sun WorkShop HPC license.)

Finds and parallelizes appropriate loops for running in parallel on multiple processors. Analyzes loops for inter-iteration data dependencies and loop restructuring. If the optimization level is not specified -O3 or higher, it will automatically be raised to -O3.

To improve performance, also specify the -stackvar option when using any of the parallelization options, including -autopar.

Avoid -autopar if the program already contains explicit calls to the libthread threads library. See note with -mt on page 72.

The -autopar option is not appropriate on a single-processor system, and the compiled code will generally run slower.

To run a parallelized program in a multithreaded environment, you must set the PARALLEL (or OMP_NUM_THREADS) environment variable prior to execution. This tells the runtime system the maximum number of threads the program can create. The default is 1. In general, set the PARALLEL or OMP_NUM_THREADS variable to the available number of processors on the target platform.

If you use -autopar and compile and link in one step, the multithreading library and the thread-safe Fortran runtime library will automatically be linked. If you use -autopar and compile and link in separate steps, then you must also link with -autopar to insure linking the appropriate libraries.

The -reduction option may also be useful with -autopar. Other parallelization options are -parallel and -explicitpar.

Refer to the Fortran Programming Guide for more information on parallelization.

Fortran parallelization features require a Sun WorkShop HPC license.


-B{static|dynamic}

Prefer dynamic or require static library linking.

No space is allowed between -B and dynamic or static. The default, without -B specified, is -Bdynamic.

Also note:

You can toggle -Bstatic and -Bdynamic on the command line. That is, you can link some libraries statically and some dynamically by specifying -Bstatic and -Bdynamic any number of times on the command line, as follows:

f77 prog.f -Bdynamic -lwells -Bstatic -lsurface

These are loader and linker options. Compiling and linking in separate steps with -Bx on the compile command will require it in the link step as well.

You cannot specify both -Bdynamic and -dn on the command line because -dn disables linking of dynamic libraries.

In a 64-bit Solaris environment, many system libraries are available only as shared dynamic libraries. These include libm.so and libc.so (libm.a and libc.a are not provided). This means that -Bstatic and -dn may cause linking errors in 64-bit Solaris environments. Applications must link with the dynamic libraries in these cases.

See the Fortran Programming Guide for more information on static and dynamic libraries.


-C

Check array references for out of range subscripts.

Subscripting arrays beyond their declared sizes may result in unexpected results, including segmentation faults. The -C option checks for possible array subscript violations in the source code and during execution.

Specifying -C may make the executable file larger.

If the -C option is used, array subscript violations are treated as an error. If an array subscript range violation is detected in the source code during compilation, it is treated as a compilation error.

If an array subscript violation can only be determined at runtime, the compiler generates range-checking code into the executable program. This may cause an increase in execution time. As a result, it is appropriate to enable full array subscript checking while developing and debugging a program, then recompiling the final production executable without subscript checking.


-c

Compile only; produce object .o files, but suppress linking.

Suppress linking. Compile a .o file for each source file. If only a single source file is being compiled, the -o option can be used to specify the name of the .o file written.


-cg89

Compile for generic SPARC architecture. (Obsolete)

This option is a macro for: -xarch=v7 -xchip=old -xcache=64/32/1 which is equivalent to -xtarget=ss2 .


-cg92

Compile for SPARC V8 architecture. (Obsolete)

This option is a macro for:
-xarch=v8 -xchip=super -xcache=16/32/4:1024/32/1 which is equivalent to -xtarget=ss1000 .


-copyargs

Allow assignment to constant arguments.

Allow a subprogram to change a dummy argument that is a constant. This option is provided only to allow legacy code to compile and execute without a runtime error.

Code that aborts unless compiled with -copyargs is, of course, not Fortran standard compliant. Also, such code is often unpredictable.


-Dname[=def]

Define symbol name for the preprocessor.

This option only applies to .F and .f95 source files.

-Dname=def                 Define name to have value def

-Dname                          Define name to be 1

On the command line, this option will define name as if:

#define name[=def]

had appears in the source file. If no =def specified, the name name is defined as the value 1. The macro symbol name is passed on to the preprocessor fpp (or cpp -- see the -xpp option) for expansion.

Following are the predefined values (these symbols have two leading underscores):

The compilers use the fpp(1) preprocessor by default. Like the C preprocessor cpp(1), fpp expands source code macros and enables conditional compilation of code. Unlike cpp, fpp understands Fortran syntax, and is preferred as a Fortran preprocessor. Use the -xpp=cpp flag to force the compiler to specifically use cpp rather than fpp.


-dalign

Align COMMON block data and generate faster multi-word load/stores.

This flag changes the data layout in COMMON blocks (and EQUIVALENCE classes), and enables the compiler to generate faster multi-word load/stores for that data.

The data layout effect is that of the -f flag: double- and quad-precision data in COMMON blocks and EQUIVALENCE classes are laid out in memory along their "natural" alignment, which is on 8-byte boundaries (or on 16-byte boundaries for quad-precision when compiling for 64-bit environments with -xarch=v9 or v9a). The default alignment of data in COMMON blocks is on 4-byte boundaries. The compiler is also allowed to assume natural alignment and generate faster multi-word load/stores to reference the data.


Note – -dalign may result in nonstandard alignment of data, which could cause problems with variables in EQUIVALENCE or COMMON and may render the program non-portable if -dalign is required.

-dalign is a macro equivalent to: -xmemalign=8s -aligncommon=8 See --xmemalign, page 107.

Using both -dbl and -dalign also causes default INTEGER variables to be 8-byte aligned and 64-bits. Also:

-xtypemap=real:x,double:y,integer:64

If you compile one subprogram with -dalign, compile all subprograms of the program with -dalign. This option is included in the -fast option.


-db

Generate optional CIF file.


-dbl

Double the default size for REAL, INTEGER, DOUBLE, and COMPLEX.

-dbl promotes the default byte size for REAL, INTEGER,DOUBLE,and COMPLEX variables declared without an explicit byte size as follows:

TABLE 3-7   Default Data Sizes and -dbl (Bytes)
Without -dbl option With -dbl option
Data Type default SPARC
 INTEGER
4 8
 REAL
4 8
 DOUBLE
8 16


This option applies to variables, parameters, constants, and functions.

Also, LOGICAL is treated as INTEGER, COMPLEX as two REALs, and DOUBLE COMPLEX as two DOUBLEs.

Compare -dbl with -r8: -dbl and -r8 can be expressed in terms of the more general -xtypemap= option:

These options promote default DOUBLE PRECISION data to QUAD PRECISION (128 bits). This may be unwanted and may cause performance degradation. It might be more appropriate to use -xtypemap=real:64,double:64,integer:64 instead of -dbl in these cases.

For all of the floating point data types, -dbl works the same as -r8; using both -r8 and -dbl produces the same results as using only -dbl.

In general, if you compile one subprogram with -dbl, then be sure to compile all subprograms of that program with -dbl. This is particularly important with programs communicating through files with unformatted I/O -- if one program is compiled with -dbl, then the other program must similarly be compiled. Be also aware that this option alters the default data size of function names, including calls to library functions, unless the function name is typed explicitly with a data size.


dbl_align_all={yes|no}

Force alignment of all data on 8-byte boundaries

The value is either yes or no. If yes, all variables will be aligned on 8-byte boundaries. Default is -dbl_align_all=no.

When compiling for 64-bit environments with -xarch=v9 or v9a, this flag will align quad-precision data on 16-byte boundaries.

This flag does not alter the layout of data in COMMON blocks or user-defined structures.

On SPARC, use with -dalign to enable added efficiency with multi-word load/stores.

If used, all routines must be compiled with this flag.


-depend

Analyze loops for data dependencies.

Analyze loops for inter-iteration data dependencies and do loop restructuring. This option will raise the optimization level to O3 if no optimization level is specified, or if it is specified less than O3. -depend is also included with -fast, -autopar and -parallel. (See the Fortran Programming Guide.)


-dryrun

Show commands built by driver, but do not compile.

Useful when debugging, this option displays the commands it will run to perform the compilation.


-d{y|n}

Allow or disallow dynamic libraries for the entire executable

The default, if not specified, is -dy.

Unlike -Bx, this option applies to the whole executable and need appear only once on the command line.

-dy|-dn are loader and linker options. If you compile and link in separate steps with these options, then you need the same option in the link step.

In a 64-bit Solaris environment, many system libraries are not available only as shared dynamic libraries. These include libm.so and libc.so (libm.a and libc.a are not provided). This means that -dn and -Bstatic may cause linking errors in 64-bit Solaris environments. Applications must link with the dynamic libraries in these cases.


-e

Accept extended length input source line.

Accept source lines up to 132 characters long. The compiler pads on the right with trailing blanks to column 132. If you use continuation lines while compiling with -e, then do not split character constants across lines, otherwise, unnecessary blanks may be inserted in the constants.


erroff=taglist

Suppress warning messages listed by tag name.

Suppress displaying the warning messages specified in the comma-separated list of tag names taglist. If taglist consists of %none, no warnings are suppressed. If taglist consists of %all, all warnings are suppressed (this is equivalent to the -w option.)

Example:

f77 -erroff=WDECL_LOCAL_NOTUSED ink.f

Use the -errtags option to see the tag names associated with warning messages.


errtags

Display the message tag with each warning message.

With this option, the compiler's internal error tag name will appear along with warning messages. The default is not to display the tag.

demo% f77 -errtags ink.f
ink.f:
 MAIN:
"ink.f", line 11: Warning: local variable "i" never used 
(WDECL_LOCAL_NOTUSED)  <- The warning message's tag name


explicitpar

Parallelize loops or regions explicitly marked by directives.

The compiler will generate parallel code even if there are data dependencies in the DO loop that would cause the loop to generate incorrect results when run in parallel. With explicit parallelization, it is the user's responsibility to correctly analyze loops for data dependency problems before marking them with parallelization directives.

This option enables Sun, Cray, and/or OpenMP explicit parallelization directives. DO loops immediately preceded by parallelization directives will have threaded code generated for them. Parallelization is only appropriate on multiprocessor systems. This option should not be used to compile programs that already do their own multithreading with calls to the libthread library.

To run a parallelized program in a multithreaded environment, you must set the PARALLEL (or OMP_NUM_THREADS) environment variable prior to execution. This tells the runtime system the maximum number of threads the program can create. The default is 1. In general, set the PARALLEL or OMP_NUM_THREADS variable to the available number of processors on the target platform.

If you use -explicitpar and compile and link in one step, then linking automatically includes the multithreading library and the thread-safe Fortran runtime library. If you use -explicitpar and compile and link in separate steps, then you must also link with -explicitpar.

To improve performance, also specify the -stackvar option when using any of the parallelization options, including -explicitpar.

Use the -mp option (page 72) to select the style of parallelization directives enabled: Sun, Cray, or OpenMP.

If the optimization level is not -O3 or higher, it is raised to -O3 automatically.

For details, see the Parallelization chapter in the Fortran Programming Guide.

Fortran parallelization features require a Sun WorkShop HPC license.


-ext_names=e

Create external names with or without trailing underscores.

e must be either plain or underscores. The default is underscores.

-ext_names=plain: Do not add trailing underscore.

-ext_names=underscores: Add trailing underscore.

An external name is a name of a subroutine, function, block data subprogram, or labeled common. This option affects both the name of the routine's entry point and the name used in calls to it. This option may be used to allow Fortran 77 routines to call and be called by other language routines.


-F

Invoke the source file preprocessor, but do not compile.

Apply the fpp preprocessor to .F files (and .f95 files with f95) and write the processed result on a file with the same name but with suffix changed to .f (or .f95), but do not compile.

Example:

f77 -F source.F

writes the processed source file to source.f

fpp is the default preprocessor for Fortran. The C preprocessor, cpp, can be selected instead by specifying -xpp=cpp.


-f

Align data in COMMON blocks.

Align double- and quad-precision data in COMMON blocks.

This flag changes the data layout in COMMON blocks (and EQUIVALENCE classes): double- and quad-precision data in COMMON blocks and EQUIVALENCE classes are laid out in memory along their "natural" alignment, which is on 8-byte boundaries (or on 16-byte boundaries for quad-precision when compiling for 64-bit environments with -xarch=v9 or v9a). The default alignment of data in COMMON blocks is on 4-byte boundaries.


Note – -f may result in nonstandard alignment of data, which could cause problems with variables in EQUIVALENCE or COMMON and may render the program non-portable if -f is required.

Using -dbl with -f aligns all 64-bit integer data on 8-byte boundaries as well.

Compiling any part of a program with -f requires compiling all subprograms of that program with -f.

By itself, this option does not enable the compiler to generate faster multi-word fetch/store instructions on double and quad precision data. The -dalign option does this and invokes -f as well. Use of -dalign is preferred over the older -f.
See -dalign, page 52. Because -dalign is part of the -fast option, so is -f.


-fast

Optimize for speed of execution using a selection of options.

Select options that optimize for speed of execution without excessive compilation time. This option provides close-to-the-maximum performance for many applications.

If you compile and link in separate steps, and you compile with -fast, then be sure to link with -fast.

-fast selects the following options:

Details about the options selected by -fast:

It is possible to add or subtract from this list by following the -fast option with other options, as in:

f95 -fast -fsimple=1 -xnolibmopt ...

which overrides the -fsimple=2 option and disables the -xlibmopt selected by -fast.


-fixed

Specify fixed-format Fortran 95 source input files.

All source files on the command-line will be interpreted as f77 fixed format regardless of filename extension. Normally, f95 interprets only .f files as fixed format, .f95 as free format.


-flags

Synonym for -help.


-fnonstd

Initialize floating-point hardware to non-standard preferences.

This option is a synonym for the combination of the following option flags:

Specifying -fnonstd is approximately equivalent to the following two calls at the beginning of a Fortran main program.

i=ieee_handler("set", "common", SIGFPE_ABORT)
call nonstandard_arithmetic() 

The nonstandard_arithmetic() routine replaces the obsolete abrupt_underflow() routine of earlier releases.

To be effective, the main program must be compiled with this option.

Using this option initializes the floating-point hardware to:

See -fns for more information about gradual underflow and subnormal numbers.

The -fnonstd option allows hardware traps to be enabled for floating-point overflow, division by zero, and invalid operation exceptions. These are converted into SIGFPE signals, and if the program has no SIGFPE handler, it terminates with a dump of memory.

For more information, see the ieee_handler(3m) and ieee_functions(3m) man pages, the Numerical Computation Guide, and the Fortran Programming Guide.


-fns[={no|yes}]

Select the SPARC nonstandard floating-point mode.

The default is the SPARC standard floating-point mode (-fns=no). (See the Floating-Point Arithmetic chapter of the Fortran Programming Guide.)

Optional use of =yes or =no provides a way of toggling the -fns flag following some other macro flag that includes it, such as -fast. -fns is the same as -fns=yes.

This option flag enables nonstandard floating-point mode when the program begins execution. On some SPARC systems, specifying nonstandard floating-point mode disables "gradual underflow", causing tiny results to be flushed to zero rather than producing subnormal numbers. It also causes subnormal operands to be silently replaced by zero. On those SPARC systems that do not support gradual underflow and subnormal numbers in hardware, use of this option can significantly improve the performance of some programs.

Where x does not cause total underflow, x is a subnormal number if and only if |x| is in one of the ranges indicated:

TABLE 3-8   Subnormal REAL and DOUBLE
Data Type Range
REAL
0.0 < |x| < 1.17549435e-38
DOUBLE PRECISION
0.0 < |x| < 2.22507385072014e-308


See the Numerical Computation Guide for details on subnormal numbers, and the Fortran Programming Guide chapter Floating-Point Arithmetic for more information about this and similar options. (Some arithmeticians use the term denormalized number for subnormal number.)

The standard initialization of floating-point preferences is the default:

To be effective, the main program must be compiled with this option.


-fpover[={yes|no}]

Detect floating-point overflow in formatted input.

With -fpover=yes specified, the I/O library will detect runtime floating-point overflows in formatted input and return an error condition (1031). The default is no such overflow detection (-fpover=no). -fpover is equivalent to -fpover=yes.


-fpp

Force preprocessing of input with fpp.

Pass all the input source files listed on the f95 command line through the fpp preprocessor, regardless of file extension. (Normally, only files with .F, .F90, or .F95 extension are automatically preprocessed by fpp.) See also -xpp, page 109.


-free

Specify free-format source input files.

All source files on the command-line will be interpreted as f95 free format regardless of filename extension. Normally, f95 interprets .f files as fixed format, .f95 as free format.


-fround=r

Set the IEEE rounding mode in effect at startup.

r must be one of: nearest, tozero, negative, positive.

The default is -fround=nearest.

To be effective, compile the main program with this option.

This option sets the IEEE 754 rounding mode that:

When r is tozero, negative, or positive, the option sets the rounding direction to round-to-zero, round-to-negative-infinity, or round-to-positive-infinity, respectively, when the program begins execution. When -fround is not specified, -fround=nearest is used as the default and the rounding direction is round-to-nearest. The meanings are the same as those for the ieee_flags function. (See the Floating-Point Arithmetic chapter of the Fortran Programming Guide.)


-fsimple[=n]

Select floating-point optimization preferences.

Allow the optimizer to make simplifying assumptions concerning floating-point arithmetic. (See the Floating-Point Arithmetic chapter of the Fortran Programming Guide.)

For consistent results, compile all units of a program with the same -fsimple option.

If n is present, it must be 0, 1, or 2. The defaults are:

The different floating-point simplification levels are:

-fsimple=0

Permit no simplifying assumptions. Preserve strict IEEE 754 conformance.

-fsimple=1

Allow conservative simplifications. The resulting code does not strictly conform to IEEE 754, but numeric results of most programs are unchanged.

With -fsimple=1, the optimizer can assume the following:

With -fsimple=1, the optimizer is not allowed to optimize completely without regard to roundoff or exceptions. In particular, a floating-point computation cannot be replaced by one that produces different results with rounding modes held constant at run time.

-fsimple=2

Permit aggressive floating point optimizations that may cause many programs to produce different numeric results due to changes in rounding.
For example, -fsimple=2 permits the optimizer to attempt to replace repeated computations of x/y with x*z, where z=1/y is computed once and saved in a temporary, eliminating the costly divide operation.
Even with -fsimple=2, the optimizer still is not permitted to introduce a floating point exception in a program that otherwise produces none.
-fast sets -fsimple=2.

-ftrap=t

Set floating-point trapping mode in effect at startup.

t is a comma-separated list that consists of one or more of the following:

%all, %none, common, [no%]invalid, [no%]overflow, [no%]underflow, [no%]division, [no%]inexact.

-ftrap=common is a macro for
-ftrap=invalid,overflow,underflow,division.

Where the % is shown, it is a required character.

The f77 default is -ftrap=%none. The f95 default is -ftrap=common.

This option sets the IEEE 754 trapping modes that are established at program initialization. Processing is left-to-right. The common exceptions, by definition, are invalid, division by zero, and overflow. For example: -ftrap=overflow.

Example: -ftrap=%all,no%inexact means set all traps, except inexact.

The meanings for -ftrap=t are the same as for ieee_flags(), except that:

To be effective, compile the main program with this option.

For further information, see the Floating-Point Arithmetic chapter in the Fortran Programming Guide.

Build a dynamic shared library instead of an executable file.

Direct the linker to build a


-g

Compile for debugging.

Produce additional symbol table information for debugging with dbx(1) or the Sun WorkShop debugging utility.

Although some debugging is possible without specifying -g, the full capabilities of dbx and debugger are only available to those compilation units compiled with -g.

Some capabilities of other options specified along with -g may be limited. See the dbx documentation for details.

For SPARC: The -g option makes -xildon the default incremental linker option when .o object files appear on the command line (see page 102). That is, with -g, the compiler default behavior is to automatically invoke ild in place of ld, unless the -G option is present, or any source file is named on the command line.


-hname

Specify the name of the generated dynamic shared library.

This option is passed on to the linker. For details, see the Solaris Linker and Libraries Guide, and the Fortran Programming Guide chapter Libraries.

The -hname option records the name name to the shared dynamic library being created as the internal name of the library. A space between -h and name is optional (except if the library name is elp, for which the space will be needed). In general, name must be the same as what follows the -o. Use of this option is meaningless without also specifying -G.

Without the -hname option, no internal name is recorded in the library file.

If the library has an internal name, whenever an executable program referencing the library is run the runtime linker will search for a library with the same internal name in any path the linker is searching. With an internal name specified, searching for the library at runtime linking is more flexible. This option can also be used to specify versions of shared libraries.

If there is no internal name of a shared library, then the linker uses a specific path for the shared library file instead.


-help

Display a summary list of compiler options.

Displays a list of option summaries. See also -xhelp=h on page 101.


-Idir

Add dir to the INCLUDE file search path.

Insert the directory dir at the start of the INCLUDE file search path. No space is allowed between -I and dir. Invalid directories are ignored with no warning message.

The include file search path is the list of directories searched for INCLUDE files--file names appearing on preprocessor #include directives, or Fortran INCLUDE statements.

Example: Search for INCLUDE files in /usr/app/include:

demo% f77 -I/usr/app/include growth.F

Multiple -Idir options may appear on the command line. Each adds to the top of the search path list (first path searched).

The search order for relative path on INCLUDE or #include is:

  1. The directory that contains the source file

  2. The directories that are named in the -Idir options

  3. The directories in the default list

The default list for -Idir depends on the installation directory for the compiler. In a standard install, compiler software packages reside in the /opt directory; however, systems administrators may decide to install packages in other locations. The default search paths for INCLUDE files are:

where <install_dir> is the path to the installed packages (typically /opt in a normal install), and <release> is a path that varies with each release.


-i2

Set the default integer size to two bytes.

Set the default size to 2 bytes for integer and logical constants and variables declared without an explicit size. ( INTEGER*n Y still declares Y to be n bytes regardless of the -i2.) This option may degrade performance. It is generally recommended to declare specific variables INTEGER*2 rather than use -i2.


-i4

Set the default integer size to four bytes.

Set the default size to 4 bytes for integer and logical constants and variables declared without an explicit size. ( INTEGER*n Y still declares Y to be n bytes regardless of the -i4.).

Although 4 bytes is the default size for INTEGER and LOGICAL, this option can be used for overriding settings made by options like -dbl and -r8, which set these defaults to 8:

demo% f77 -dbl -i4 *.f
Command line warning: -i4 overrides integer part of -dbl
...


-inline=[%auto][[,][no%]f1,...[no%]fn]

Enable or disable inlining of specified routines.

Request the optimizer inline the user-written routines named in the f1,...,fn list. Prefixing a routine name with no% disables inlining of that routine.

Inlining is an optimization technique whereby the compiler effectively replaces a subprogram reference such as a CALL or function call with the actual subprogram code itself. Inlining often provides the optimizer more opportunities to produce efficient code.

The lists are a comma-separated list of functions and subroutines. To inhibit inlining of a function, prefix its name with no%.

The appearance of -inline with -O4 disables the automatic inlining that the compiler would normally perform, unless %auto is specified with -inline.

Example: Inline the routines xbar, zbar, vpoint:

demo% f95 -O3 -inline=xbar,zbar,vpoint *.f

Following are the restrictions; no warnings are issued:

With -O4, the compilers normally try to inline all appropriate user-written subroutines and functions. Adding -inline with -O4 may degrade performance by restricting the optimizer's inlining to only those routines in the list. In this case, use the %auto suboption to enable automatic inlining at -O4 and -O5.

demo% f95 -O4 -inline=%auto,no%zpoint *.f

In the example above, the user has enabled -O4's automatic inlining while disabling any possible inlining of the routine zpoint() that the compiler might attempt.


-Kpic

Synonym for -pic.


-KPIC

Synonym for -PIC.


-Ldir

Add dir to list of directories to search for libraries.

Adds dir to the front of the list of object-library search directories. A space between --L and dir is optional. This option is passed to the linker. See also -lx on page 69.

While building the executable file,ld(1) searches dir for archive libraries (.a files) and shared libraries (.so files). ld searches dir before searching the default directories. (See the Fortran Programming Guide chapter Libraries for information on library search order.) For the relative order between LD_LIBRARY_PATH and -Ldir, see ld(1).

Example: Use -Ldir to specify library search directories:

demo% f77 -Ldir1 -Ldir2 any.f


Note – Specifying /usr/lib or /usr/ccs/lib with -Ldir may prevent linking the unbundled libm. These directories are searched by default.


-lx

Add library libx.a to linker's list of search libraries.

Pass -lx to the linker to specify additional libraries for ld to search for unresolved references. ld links with object library libx. If shared library libx.so is available (and -Bstatic or -dn are not specified), ld uses it, otherwise, ld uses static library libx.a. If it uses a shared library, the name is built in to a.out. No space is allowed between -l and x character strings.

Example: Link with the library libV77:

demo% f77 any.f -lV77

Use -lx again to link with more libraries.

Example: Link with the libraries liby and libz:

demo% f77 any.f -ly -lz 

See also the Libraries chapter in the Fortran Programming Guide for information on library search paths and search order.


libmil

Inline selected libm library routines for optimization.

There are inline templates for some of the libm library routines. This option selects those inline templates that produce the fastest executable for the floating-point options and platform currently being used.

For more information, see the man pages libm_single(3F) and libm_double(3F)


-loopinfo

Show parallelization results.

Show which loops were and were not parallelized with the -parallel-autopar, or -explicitpar options. (Option -loopinfo must appear with one of these parallelization options.)

The parallelization features of the Fortran compilers require a Sun WorkShop HPC license.

-loopinfo displays a list of messages on standard error:

demo% f77 -o shalow -fast -parallel -loopinfo shalow.f
shalow.f:
 MAIN shalow:
     inital:
     calc1:
...etc
"shalow.f", line 78: not parallelized, call may be unsafe
"shalow.f", line 172: PARALLELIZED
"shalow.f", line 173: not parallelized, not profitable
"shalow.f", line 181: PARALLELIZED, fused
"shalow.f", line 182: not parallelized, not profitable
"shalow.f", line 226: PARALLELIZED, and serial version generated
"shalow.f", line 227: not parallelized, not profitable
...etc

Use the error(1) utility with f77 compilations to merge this list with the source file to produce an annotated source listing with each loop tagged as parallelized or not.

Example: Passing standard error to the error utility:

demo$ f77 -autopar -loopinfo any.f 2>&1 | error options

Be aware that error rewrites the input source file. For details on error, see the error(1) man page and the Fortran Programming Guide chapter on debugging.


Mdir

Add dir to directories searched for Fortran 95 modules.

Add dir to the list of directories to be searched for module files. No space appears between the -M and dir.

The directories listed with -M are searched after the current directory. Compiling a source file containing a module generates a .mod module file for each MODULE encountered. See in Appendix , Module Files for more information about modules in Fortran 95.


-misalign

Allow misaligned data.

The -misalign option permits misaligned data in memory that would otherwise produce an error. Particular uses of COMMON and EQUIVALENCE statements may cause data to be misaligned (with a compiler diagnostic). With -misalign, the compiler will allow intentional misalignment and will not add padding in COMMON blocks to insure proper data alignment. However, this seriously degrades performance; recoding to eliminate the cause of data misalignment is a better alternative.

If used, all routines in a program must be compiled with this option. If you compile and link in separate steps, compiling with the -misalign option requires the option on the link step as well.

-misalign is a macro equivalent to: -xmemalign=1i -aligncommon=1

See -xmemalign, page 107.


-mp={%none|sun|cray|openmp}

Select the style for parallelization directives.

The default without specifying -mp is %none.

-mp=sun
Accept Sun-style directives: C$PAR or !$PAR prefix.
-mp=cray
Accept Cray-style directives: CMIC$ or !MIC$ prefix.
-mp=openmp
: Accept OpenMP Fortran directives (Available with f95 only).
-mp=%none
Ignore all parallelization directives.


You can combine OpenMP directives with Sun or Cray directives in the same compilation unit. But both Sun and Cray directives cannot both be active in the same compilation unit. For example:

-mp=sun,openmp         and
-mp=cray,openmp     are permitted, but -mp=sun,cray is not.

You must also specify -explicitpar (or -parallel) to enable parallelization. For correctness, also specify -stackvar:

-explicitpar -stackvar -mp=openmp

See also -openmp, page 78.

Fortran parallelization features require a Sun WorkShop HPC license.

A summary of these f77/f95 directives appears in Appendix  in this manual. See the Fortran Programming Guide for details.


-mt

Require thread-safe libraries.

Require linking to thread-safe libraries. If you do your own low-level thread management (for example, by calling the libthread library), compiling with -mt prevents conflicts.

Use -mt if you mix Fortran with C multithread C code that calls the libthread library. See also the Solaris Multithreaded Programming Guide.

-mt is implied automatically when using the -autopar, -explicitpar, or -parallel options.

Note the following:


-native

Optimize performance for the host system. (Obsolete)

This option is a synonym for -xtarget=native. The -fast option sets -xtarget=native.


-noautopar

Disable automatic parallelization.

Disables automatic parallelization invoked by -autopar earlier on the command line.


-nodepend

Cancel -depend in command line.

Cancel any -depend appearing earlier on the command line.


noexplicitpar

Disable explicit parallelization.

Disables explicit parallelization invoked by -explicitpar earlier on the command line.


-nolib

Disable linking with system libraries.

Do not automatically link with any system or language library; that is do not pass any default -lx options on to ld. The normal behavior is to link system libraries into the executables automatically, without the user specifying them on the command line.

The -nolib option makes it easier to link one of these libraries statically. The system and language libraries are required for final execution. It is your responsibility to link them in manually. This option provides you with complete control.

For example, consider a program linked dynamically with libF77 that fails on a remote system because has no libF77. With this option you can link the library into your program statically.

Link libF77 statically and link libc dynamically with f77:

demo% f77 -nolib any.f -Bstatic -lF77 -Bdynamic -lm -lc

Link libm statically and libc dynamically with f95:

demo% f95 -nolib any.f95 -Bstatic -lm -Bdynamic -lc

The order for the -lx options is important. Follow the order shown in the examples.


-nolibmil

Cancel -libmil on command line.

Use this option after the -fast option to disable inlining of libm math routines:

demo% f77 -fast -nolibmil ...


-noqueue

Disable license queueing.

With this option, if no software license is available to run the compiler, it returns without queueing your request and without compiling. A nonzero environment status is returned for testing in make files.


-noreduction

Cancel -reduction on command line.

-reduction is used with other parallelization options. This option cancels
-reduction.


-norunpath

Do not build a runtime shared library search path into the executable.

The compiler normally builds into an executable a path that tells the runtime linker where to find the shared libraries it will need. The path is installation dependent. The -norunpath option prevents that path from being built in to the executable.

This option is helpful when libraries have been installed in some nonstandard location, and you do not wish to make the loader search down those paths when the executable is run at another site. Compare with -Rpaths.

See the Fortran Programming Guide chapter on Libraries for more information.


-O[n]

Specify optimization level.

n can be 1, 2, 3, 4, or 5. No space is allowed between -O and n.

If -O[n] is not specified, only a very basic level of optimization limited to local common subexpression elimination and dead code analysis is performed. A program's performance may be significantly improved when compiled with an optimization level than without optimization. Use of -O (which sets -O3) or
-fast (which sets -O5) is recommended for most programs.

Each -On level includes the optimizations performed at the levels below it. Generally, the higher the level of optimization a program is compiled with, the better runtime performance obtained. However, higher optimization levels may result in increased compilation time and larger executable files.

Debugging with -g does not suppress -On, but -On limits -g in certain ways; see the dbx documentation.

The -O3 and -O4 options reduce the utility of debugging such that you cannot display variables from dbx, but you can still use the dbx where command to get a symbolic traceback.

For SPARC: If the optimizer runs out of memory, it attempts to proceed over again at a lower level of optimization, resuming compilation of subsequent routines at the original level.

For details on optimization, see the Fortran Programming Guide chapters Performance Profiling, and Performance and Optimization.


-O

This is equivalent to -O3.


-O1

Provides a minimum of statement-level optimizations.

Use if higher levels result in excessive compilation time, or exceed available swap space.


-O2

Enables basic block level optimizations.

This level usually gives the smallest code size. (See also -xspace.)

-O3 is preferred over -O2 unless -O3 results in unreasonably long compilation time, exceeds swap space, or generates excessively large executable files.


-O3

Adds loop unrolling and global optimizations at the function level.

Usually -O3 generates larger executable files.


-O4

Adds automatic inlining of routines contained in the same file.

Usually -O4 generates larger executable files due to inlining.

The -g option suppresses the -O4 automatic inlining described above.
-xcrossfile increases the scope of inlining with -O4.


-O5

Attempt aggressive optimizations.

Suitable only for that small fraction of a program that uses the largest fraction of compute time. -O5's optimization algorithms take more compilation time, and may also degrade performance when applied to too large a fraction of the source program.

Optimization at this level is more likely to improve performance if done with profile feedback. See -xprofile=p.


-o name

Specify the name of the executable file to be written.

There must be a blank between -o and name. Without this option, the default is to write the executable file to a.out. When used with -c, -o specifies the target .o object file; with -G it specifies the target .so library file.


-oldldo

Select "old" list-directed output style.

Omit the blank that starts each record for list-directed output. This is a change from f77 releases 1.4 and earlier. The default behavior is to provide that blank, since the Fortran Standard requires it. Note also the FORM='PRINT' option of OPEN. You can compile parts of a program with -oldldo and other parts without it.


-onetrip

Enable one trip DO loops.

Compile DO loops such that they are executed at least once. DO loops in standard Fortran are not performed at all if the upper limit is smaller than the lower limit, unlike some legacy implementations of Fortran.


-openmp

Enable explicit parallelization with Fortran 95 OpenMP directives.

This option is a macro for the combination of options:

-mp=openmp -explicitpar -stackvar -D_OPENMP

OpenMP directives are summarized in Appendix .

To run a parallelized program in a multithreaded environment, you must set the PARALLEL (or OMP_NUM_THREADS) environment variable prior to execution. This tells the runtime system the maximum number of threads the program can create. The default is 1. In general, set the PARALLEL or OMP_NUM_THREADS variable to the available number of processors on the target platform.

Fortran parallelization features require a Sun WorkShop HPC license.


-p

Compile for profiling with the prof profiler.

Prepare object files for profiling, see prof (1). If you compile and link in separate steps, and if you compile with the -p option, then be sure to link with the -p option. -p with prof is provided mostly for compatibility with older systems. -pg profiling with gprof is possibly a better alternative. See the Fortran Programming Guide chapter on Performance Profiling for details.


-pad[=p]

Insert padding for efficient use of cache.

This option inserts padding between arrays or character variables if they are static local and not initialized, or in common blocks. The extra padding positions the data to make better use of cache. In either case, the arrays or character variables can not be equivalenced.

For -pad[=p], if p is present, it must be either (or both):

local
Add padding between adjacent local variables
common
Add padding between variables in common blocks


Defaults for -pad:

The following are equivalent:

The -pad[=p] option applies to items that satisfy the following criteria:

For a definition of local or static variables, see -stackvar, page 86.

Restrictions on -pad=common:


parallel

Parallelize with: -autopar, -explicitpar, -depend

Parallelize loops chosen automatically by the compiler as well as explicitly specified by user supplied directives. Optimization level is automatically raised to -O3 if it is lower.

To improve performance, also specify the -stackvar option when using any of the parallelization options, including -autopar.

Use -mp, page 72, to select Sun, Cray, or f95 OpenMP style parallelization directives.

Avoid -parallel if you do your own thread management. See the discussion of -mt on page 72.

Parallelization options like -parallel are intended to produce executable programs to be run on multiprocessor systems. On a single-processor system, parallelization generally degrades performance.

To run a parallelized program in a multithreaded environment, you must set the PARALLEL (or OMP_NUM_THREADS) environment variable prior to execution. This tells the runtime system the maximum number of threads the program can create. The default is 1. In general, set the PARALLEL or OMP_NUM_THREADS variable to the available number of processors on the target platform.

If you use -parallel and compile and link in one step, then linking automatically includes the multithreading library and the thread-safe Fortran runtime library. If you use -parallel and compile and link in separate steps, then you must also link with -parallel.

Fortran parallelization features require a Sun WorkShop HPC license.

See the Fortran Programming Guide chapter Parallelization for further information.


-pg

Compile for profiling with the gprof profiler.

Compile self-profiling code in the manner of -p, but invoke a runtime recording mechanism that keeps more extensive statistics and produces a gmon.out file when the program terminates normally. Generate an execution profile by running gprof. See the gprof(1) man page and the Fortran Programming Guide for details.

Library options must be after the .f and .o files (-pg libraries are static).

If you compile and link in separate steps, and you compile with -pg, then be sure to link with -pg.


-pic

Compile position-independent code for shared library.

This kind of code is for dynamic shared libraries. Each reference to a global datum is generated as a dereference of a pointer in the global offset table. Each function call is generated in program-counter-relative addressing mode through a procedure linkage table.

-pic is equivalent to -xcode=pic13.

There are two nominal performance costs with -pic and -PIC:

When considering the above costs, remember that the use of -pic and
-PIC can significantly reduce system memory requirements, due to the effect of library code sharing. Every page of code in a shared library compiled
-pic or -PIC can be shared by every process that uses the library. If a page of code in a shared library contains even a single non-pic (that is, absolute) memory reference, the page becomes nonsharable, and a copy of the page must be created each time a program using the library is executed.

The easiest way to tell whether or not a .o file has been compiled with -pic or
-PIC is with the nm command:

% nm  file.o | grep _GLOBAL_OFFSET_TABLE_ 
U _GLOBAL_OFFSET_TABLE_

A .o file containing position-independent code contains an unresolved external reference to _GLOBAL_OFFSET_TABLE_, as indicated by the letter U.

To determine whether to use -pic or -PIC, use nm to identify the number of distinct global and static variables used or defined in the library. If the size of _GLOBAL_OFFSET_TABLE_ is under 8,192 bytes, you can use -pic. Otherwise, you must use -PIC.

When building shared dynamic libraries with -xarch=v9 or v9a on 64-bit Solaris 7, the -pic or -PIC option, or their -xcode equivalents, must be specified.


-PIC

Compile position-independent code, but with 32-bit addresses.

This option is similar to -pic, but it allows the global offset table to span the range of 32-bit addresses. Use it in those rare cases where there are too many global data objects for -pic. Do not mix -pic and -PIC.

-PIC is equivalent to -xcode=pic32.

When building shared dynamic libraries with -xarch=v9 or v9a on 64-bit Solaris 7, the -pic or -PIC option, or their -xcode equivalents, must be specified.


-Qoption pr ls

Pass options to compilation phase pr.

Pass the suboption list ls to the compilation phase pr. There must be blanks separating Qoption, pr, and ls. The Q can be uppercase or lowercase. The list is a comma-delimited list of suboptions, with no blanks within the list. Each suboption must be appropriate for that program phase, and can begin with a minus sign.

This option is provided primarily for debugging the internals of the compiler by support staff. Use the LD_OPTIONS environment variable to pass options to the linker. See the chapter on linking and libraries in the Fortran Programming Guide.


-qp

Synonym for -p.


-R ls

Build dynamic library search paths into the executable file.

With this option, the linker, ld(1), stores a list of dynamic library search paths into the executable file.

ls is a colon-separated list of directories for library search paths. The blank between -R and ls is optional.

Multiple instances of this option are concatenated together, with each list separated by a colon.

The list is used at runtime by the runtime linker, ld.so. At runtime, dynamic libraries in the listed paths are scanned to satisfy any unresolved references.

Use this option to let users run shippable executables without a special path option to find needed dynamic libraries.

Building an executable file using -Rpaths adds directory paths to a default path that is always searched last:

Standard Default Path: /opt/SUNWspro/lib

For more information, see the Libraries chapter in the Fortran Programming Guide, and the Solaris Linker and Libraries Guide.


-r8

Double default byte size for REAL,INTEGER, DOUBLE and COMPLEX.

-r8 promotes the default byte size for REAL, INTEGER, DOUBLE, and COMPLEX variables declared without an explicit byte size as follows:

TABLE 3-9   Default Data Sizes and -r8 (Bytes)
Without -r8 option With -r8 option
Data Type default SPARC
 INTEGER
4 8
 REAL
4 8
 DOUBLE
8 16


This option applies to variables, parameters, constants, and functions.

Also, LOGICAL is treated as INTEGER, COMPLEX as two REALs, and DOUBLE COMPLEX as two DOUBLEs.

-dbl and -r8 can be expressed in terms of the more general -xtypemap= option:

These options promote default DOUBLE PRECISION data to QUAD PRECISION (128 bits). This may be unwanted and may cause performance degradation. It might be more appropriate to use -xtypemap=real:64,double:64,integer:64 instead of -r8 in these cases.

In general, if you compile one subprogram with -r8, then be sure to compile all subprograms of that program with -r8. This also important with programs communicating through unformatted I/O files -- if one program is compiled with -r8, then the other program must be similarly compiled. Be also aware that this option alters the default data size of function names, including calls to library functions, unless the function name is typed explicitly with a data size.

The impact on runtime performance may be great. With -r8, an expression like float = 15.0d0*float is evaluated in quadruple precision due to the declaration of the constant.

If you select both -r8 and -i2, the results are unpredictable.


-r8const

Promote single-precision constants to REAL*8 constants.

All single-precision REAL constants are promoted to REAL*8. Double-precision (REAL*8) constants are not changed. This option only applies to constants. To promote both constants and variables use -xtypemap, page 115.


reduction

Recognize reduction operations in loops.

Analyze loops for reduction operations during automatic parallelization. There is potential for roundoff error with the reduction.

A reduction operation accumulates the elements of an array into a single scalar value. For example, summing the elements of a vector is a typical reduction operation. Although these operations violate the criteria for parallelizability, the compiler can recognize them and parallelize them as special cases when -reduction is specified. See the Fortran Programming Guide chapter Parallelization for information on reduction operations recognized by the compilers.

This option is useable only with the automatic parallelization options -autopar or -parallel. It is ignored otherwise. Explicitly parallelized loops are not analyzed for reduction operations.

Example: Automatically parallelize with reduction:

demo% f77 -parallel -reduction any.f


-S

Compile and only generate assembly code.

Compile the named programs and leave the assembly-language output on corresponding files suffixed with .s. No .o file is created.


-s

Strip the symbol table out of the executable file.

This option makes the executable file smaller and more difficult to reverse engineer. However, this option inhibits debugging with dbx or other tools, and overrides -g.


-sb

Produce table information for the Sun WorkShop source code browser.

See Using Sun WorkShop for more information.

Note: -sb cannot be used on source files the compiler automatically passes through the fpp or cpp preprocessors (that is, files with .F, .F90, or .F95 extensions).


-sbfast

Produce only source code browser tables.

Produce only table information for the Sun WorkShop source code browser and stop. Do not assemble, link, or make object files.


-silent

Suppress compiler messages.

Use this option to suppress non-essential messages from the compiler; error and warning messages are still issued. The default is to show file and entry names as they are reached during the compilation.


-stackvar

Force all local variables to be allocated on the memory stack.

Allocate on the memory stack all the local variables and arrays in routines, unless otherwise specified. This option makes these variables automatic, rather than static, and provides more freedom to the optimizer when parallelizing loops with calls to subprograms.

Use of -stackvar is recommended with any of the parallelization options.

Variables and arrays are local, unless they are:

f77 only: Initializing a local variable in a DATA statement after an executable reference to that variable is flagged as an error when -stackvar is used:

demo% cat stak.f
        real x
        x =  1.
        t = 0.
        print*, t
        data x/3.0/
        print *,x+t
        end
demo% f77 -o stak -stackvar stak.f
stak.f:
 MAIN:
"stak.f", line 5: Error: attempt to initialize an automatic
 variable: x

Putting large arrays onto the stack with -stackvar can overflow the stack causing segmentation faults. Increasing the stack size may be required.

The initial thread executing the program has a main stack, while each helper thread of a multithreaded program has its own thread stack.

The default stack size is about 8 Megabytes for the main stack and 1 Megabyte (2 Megabytes on SPARC V9 platforms) for each thread stack. The limit command (with no parameters) shows the current main stack size. If you get a segmentation fault using -stackvar, try increasing the main and thread stack sizes.

Example: Show the current main stack size:

demo% limit
cputime         unlimited
filesize        unlimited
datasize        523256 kbytes
stacksize       8192 kbytes      <---
coredumpsize    unlimited
descriptors     64 
memorysize      unlimited
demo%

Example: Set the main stack size to 64 Megabytes:

demo% limit stacksize 65536

Example: Set each thread stack size to 8 Megabytes:

demo% setenv STACKSIZE 8192

For further information of the use of -stackvar with parallelization, see the Parallelization chapter in the Fortran Programming Guide. See csh(1) for details on the limit command.


stop_status=yn

Permit STOP statement to return an integer status value.

yn is either yes or no. The default is no.

With -stop_status=yes, a STOP statement may contain an integer constant. That value will be passed to the environment as the program terminates:

STOP 123

The value must be in the range 0 to 255. Larger values are truncated and a run-time message issued. Note that

STOP `stop string'

is still accepted and returns a status value of 0 to the environment, although a compiler warning message will be issued.

The environment status variable is $status for the C shell csh, and $? for the Bourne and Korn shells, sh and ksh.


-temp=dir

Define directory for temporary files.

Set directory for temporary files used by the compiler to be dir. No space is allowed within this option string. Without this option, the files are placed in the /tmp directory.


-time

Time each compilation phase.

The time spent and resources used in each compiler pass is displayed.


-U

Recognize upper and lower case in source files.

Do not treat uppercase letters as equivalent to lowercase. The default is to treat uppercase as lowercase except within character-string constants. With this option, the compiler treats Delta, DELTA, and delta as different symbols.

Portability and mixing Fortran with other languages may require use of -U. These are discussed in the Fortran Programming Guide.


-u

Report undeclared variables.

Make the default type for all variables be undeclared rather than using Fortran implicit typing. This option warns of undeclared variables, and does not override any IMPLICIT statements or explicit type statements.


-unroll=n

Enable unrolling of DO loops where possible.

n is a positive integer. The choices are:

Loop unrolling generally improves performance, but will increase the size of the executable file. For more information on this and other compiler optimizations, see the Performance and Optimization chapter in the Fortran Programming Guide. See also the discussion of the UNROLL directive on page 29.


-V

Show name and version of each compiler pass.

This option prints the name and version of each pass as the compiler executes.

This information may be helpful when discussing problems with Sun service engineers.


-v

Verbose mode - show details of each compiler pass.

Like -V, shows the name of each pass as the compiler executes, and details the options and environment variables used by the driver.


-vax=v

Specify choice of VMS Fortran extensions enabled.

v must be a comma-separated list of at least one suboption. Negatives may be constructed by prefixing each suboption keyword by no% (as in no%logical_name).

The primary options are -vax=align and -vax=misalign.

-vax=align selects all the suboptions without allowing misaligned data. This is the behavior of the -xl option prior to f77 release 3.0.1.

-vax=misalign selects all the suboptions and allows misaligned data. This is the behavior of the -xl option with f77 releases 3.0.1, 4.0, 4.2, 5.0, and Sun WorkShop 6.

The table below lists suboptions that can be individually selected.

TABLE 3-10   -vax= Suboptions
-vax=
Affect
 blank_zero
Treat blank in a numeric field as zero.
 bslash
Allow backslash (`\') in character constants.
 debug
Allow VMS Fortran `D' debugging statements.
 logical_name
Allow VMS Fortran style logical file names.
 oct_const
Allow double quote character to signify octal constants.
 param
Allow non-standard form of PARAMETER statement.
 rsize
Allow unformatted record size in words rather than bytes.
 struct_align
Align structures as in VMS Fortran.


%all and %none can also be used to select all or none of these suboptions.

Sub- options accumulate from left to right. For example, to enable all but one feature: -vax=%all,no%rsize

See also -xl and -misalign.


w

Suppress warning messages.

This option suppresses most warning messages. However, if one option overrides all or part of an option earlier on the command line, you do get a warning.

Example: -w still allows some warnings to get through:

demo% f77  -w -fast  -silent -O4  any.f
f77: Warning: -O4 overwrites previously set optimization           
level of -O3
demo%

For f95: Individual levels from 0 to 4 can be specified: -w0 suppresses the least messages while -w4 suppresses most warning. -w is equivalent to -w0.


-xa

Synonym for -a.


-xarch=isa

Specify instruction set architecture (ISA).

Architectures that are accepted by -xarch keyword isa are shown in TABLE 3-11:

TABLE 3-11   -xarch ISA Keywords
Platform Valid -xarch Keywords
SPARC
generic, native, v7, v8a, v8, v8plus, v8plusa, 
v8plusb, v9, v9a, v9b


Note that although -xarch can be used alone, it is part of the expansion of the
-xtarget option and may be used to override the -xarch value that is set by a specific -xtarget option. For example:

% f95 -xtarget=ultra2 -xarch=v8plusb ...

overrides the -xarch=v8 set by -xtarget=ultra2

This option limits the code generated by the compiler to the instructions of the specified instruction set architecture by allowing only the specified set of instructions. This option does not guarantee use of any target-specific instructions.

If this option is used with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice results in a binary program that is not executable on the intended target platform.

Using -xarch For SPARC Platforms:

TABLE 3-12 summarizes the most general -xarch options:

TABLE 3-12   Summary of the Most General -xarch Options on SPARC Platforms
-xarch= Performance
generic
· runs adequately on all platforms
v8plusa
· runs optimally on UltraSPARC-II processors in 32-bit mode
· no execution on other platforms
v8plusb
· runs optimally on UltraSPARC-III processors in 32-bit mode
· no execution on other platforms
v9a
· runs optimally on UltraSPARC-II processors in 64-bit mode
· no execution on other platforms
v9b
· runs optimally on UltraSPARC-III processors in 64-bit mode
· no execution on other platforms


Also note the following:

For any particular choice, the generated executable may run much more slowly on earlier architectures. Also, although quad-precision (REAL*16 and long double) floating-point instructions are available in many of these instruction set architectures, the compiler does not use these instructions in the code it generates.

TABLE 3-13 gives details for each of the -xarch keywords on SPARC platforms.

TABLE 3-13   -xarch Values for SPARC Platforms  
-xarch= Meaning
generic
Compile for good performance on most systems.
This is the default. This option uses the best instruction set for good performance on most processors without major performance degradation on any of them. With each new release, the definition of "best" instruction set may be adjusted, if appropriate.
native
Compile for good performance on this system. This is the default for the -fast option. The compiler chooses the appropriate setting for the current system processor it is running on.
v7
Compile for the SPARC-V7 ISA.
Enables the compiler to generate code for good performance on the V7 ISA. This is equivalent to using the best instruction set for good performance on the V8 ISA, but without integer mul and div instructions, and the fsmuld instruction.
Examples: SPARCstation 1, SPARCstation 2
v8a
Compile for the V8a version of the SPARC-V8 ISA. By definition, V8a means the V8 ISA, but without the fsmuld instruction. This option enables the compiler to generate code for good performance on the V8a ISA.
Example: Any system based on the microSPARC I chip architecture
v8
Compile for the SPARC-V8 ISA. Enables the compiler to generate code for good performance on the V8 architecture.
Example: SPARCstation 10
v8plus
Compile for the V8plus version of the SPARC-V9 ISA. By definition, V8plus means the V9 ISA, but limited to the 32-bit subset defined by the V8plus ISA specification, without the Visual Instruction Set (VIS), and without other implementation-specific ISA extensions.

  • This option enables the compiler to generate code for good performance on the V8plus ISA.

  • The resulting object code is in SPARC-V8+ ELF32 format and only executes in a Solaris UltraSPARC environment--it does not run on a V7 or V8 processor.


    Example: Any system based on the UltraSPARC chip architecture
  • v8plusa
    
    Compile for the V8plusa version of the SPARC-V9 ISA. By definition, V8plusa means the V8plus architecture, plus the Visual Instruction Set (VIS) version 1.0, and with UltraSPARC extensions.

  • This option enables the compiler to generate code for good performance on the UltraSPARC architecture, but limited to the 32-bit subset defined by the V8plus specification.

  • The resulting object code is in SPARC-V8+ ELF32 format and only executes in a Solaris UltraSPARC environment--it does not run on a V7 or V8 processor.


    Example: Any system based on the UltraSPARC chip architecture
  • v8plusb
    
    Compile for the V8plusb version of the SPARC-V8plus ISA with UltraSPARC-III extensions. Enables the compiler to generate object code for the UltraSPARC architecture, plus the Visual Instruction Set (VIS) version 2.0, and with UltraSPARC-III extensions.

  • The resulting object code is in SPARC-V8+ ELF32 format and executes only in a Solaris UltraSPARC-III environment.

  • Compiling with this option uses the best instruction set for good performance on the UltraSPARC-III architecture.

  • v9
    
    Compile for the SPARC-V9 ISA. Enables the compiler to generate code for good performance on the V9 SPARC architecture.

  • The resulting .o object files are in ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9 is only available when compiling in a 64-bit enabled Solaris environment.

  • v9a
    
    Compile for the SPARC-V9 ISA with UltraSPARC extensions. Adds to the SPARC-V9 ISA the Visual Instruction Set (VIS) and extensions specific to UltraSPARC processors, and enables the compiler to generate code for good performance on the V9 SPARC architecture.

  • The resulting .o object files are in ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9a is only available when compiling in a 64-bit enabled Solaris operating environment.

  • v9b
    
    Compile for the SPARC-V9 ISA with UltraSPARC-III extensions. Adds UltraSPARC-III extensions and VIS version 2.0 to the V9a version of the SPARC-V9 ISA. Compiling with this option uses the best instruction set for good performance in a Solaris UltraSPARC-III environment.

  • The resulting object code is in SPARC-V9 ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC-III processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9b is only available when compiling in a 64-bit enabled Solaris operating environment.



  • -xautopar

    Synonym for -autopar.


    -xcache=c

    Define cache properties for the optimizer.

    c must be one of the following:

    The si/li/ai are defined as follows:

    si      The size of the data cache at level i, in kilobytes

    li      The line size of the data cache at level i, in bytes

    ai     The associativity of the data cache at level i

    This option specifies the cache properties that the optimizer can use. It does not guarantee that any particular cache property is used.

    Although this option can be used alone, it is part of the expansion of the
    -xtarget option; it is provided to allow overriding an -xcache value implied by a specific -xtarget option.

    TABLE 3-14   -xcache Values 
    Value Meaning
    generic
    
    Define the cache properties for good performance on most SPARC processors without any major performance degradation. This is the default.
    s1/l1/a1
    
    Define level 1 cache properties.
    s1/l1/a1:s2/l2/a2
    
    Define levels 1 and 2 cache properties.
    s1/l1/a1:s2/l2/a2:s3/l3/a3
    
    Define levels 1, 2, and 3 cache properties


    Example: -xcache=16/32/4:1024/32/1 specifies the following:

    A Level 1 cache has: 16K bytes, 32 byte line size, 4-way associativity.

    A Level 2 cache has: 1024K bytes, 32 byte line size, direct mapping associativity.


    -xcg89

    Synonym for -cg89.


    -xcg92

    Synonym for -cg92.


    -xchip=c

    Specify target processor for the optimizer.

    This option specifies timing properties by specifying the target processor.

    Although this option can be used alone, it is part of the expansion of the
    -xtarget option; it is provided to allow overriding a -xchip value implied by the a specific -xtarget option.

    Some effects of -xchip=c are:

    The following table lists the valid -xchip values:

    TABLE 3-15   Valid -xchip Values  

    Value Optimize for:
    SPARC:
    generic
    
    good performance on most SPARC processors.

    old
    
    pre-SuperSPARCTM processors.

    super
    
    the SuperSPARC chip.

    super2
    
    the SuperSPARC II chip.

    micro
    
    the MicroSPARCTM chip.

    micro2
    
    the MicroSPARC II chip.

    hyper
    
    the HyperSPARCTM chip.

    hyper2
    
    the HyperSPARC II chip.

    powerup
    
    the WeitekTM PowerUpTM chip.

    ultra
    
    the UltraSPARCTM chip.

    ultra2
    
    the UltraSPARC IITM chip.

    ultra2i
    
    the UltraSPARC IIiTM chip.

    ultra3
    
    the UltraSPARC IIITM chip.



    -xcode=code

    Specify code address space on SPARC platforms.

    The values for code are:

    abs32
    
    Generate 32-bit absolute addresses. Code+data+bss size is limited to 2**32 bytes. This is the default on 32-bit platforms: -xarch=generic, v7, v8, v8a, v8plus, v8plusa
    abs44
    
    Generate 44-bit absolute addresses. Code+data+bss size is limited to 2**44 bytes. Available only on 64-bit platforms: -xarch=v9, v9a
    abs64
    
    Generate 64-bit absolute addresses. Available only on 64-bit platforms: -xarch=v9, v9a
    pic13
    
    Generate position-independent code (small model). Equivalent to -pic. Permits references to at most 2**11 unique external symbols on 32-bit platforms, 2**10 on 64-bit platforms.
    pic32
    
    Generate position-independent code (large model). Equivalent to -PIC. Permits references to at most 2**30 unique external symbols on 32-bit platforms, 2**29 on 64-bit platforms.


    The defaults (not specifying -xcode=code explicitly) are:

    -xcode=abs32        on SPARC V8 and V7 platforms.
    -xcode=abs64        on SPARC and UltraSPARC V9 (-xarch=v9 or v9a)

    When building shared dynamic libraries with -xarch=v9 or v9a and the 64-bit Solaris 7 environment, -xcode=pic13 or -xcode=pic32 (or -pic or -PIC) must be specified.


    -xcommonchk[={no|yes}]

    Enable runtime checking of common block inconsistencies.

    This option provides a debug check for common block inconsistencies in programs using TASK COMMON and parallelization. (See the discussion of the TASK COMMON directive in the Parallelization chapter in the Fortran Programming Guide.)

    The default is -xcommonchk=no; runtime checking for common block inconsistencies is disabled because it will degrade performance. Use it only during program development and debugging, and not for production-quality programs.

    Compiling with -xcommonchk=yes enables runtime checking. If a common block declared in one source program unit as a regular common block appears somewhere else on a TASK COMMON directive, the program will stop with an error message indicating the first such inconsistency.


    xcrossfile [=n]

    Enable optimization and inlining across source files.

    If specified, n may be 0, or 1.

    Normally, the scope of the compiler's analysis is limited to each separate file on the command line. For example, -O4's automatic inlining is limited to subprograms defined and referenced within the same source file.

    With -xcrossfile, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.

    -xcrossfile is only effective when used with -O4 or -O5.

    Cross-file inlining creates a possible source file interdependence that would not normally be there. If any file in a set of files compiled together with
    -xcrossfile is changed, then all files must be recompiled to insure that the new code is properly inlined. See the discussion of inlining on page 67.

    The default, without -xcrossfile on the command line, is -xcrossfile=0, and no cross-file optimizations are performed. To enable cross-file optimizations, specify -xcrossfile (equivalent to -xcrossfile=1).


    -xdepend

    Synonym for -depend.


    -xexplicitpar

    Synonym for -explicitpar.


    -xF

    Allow function-level reordering by the Sun WorkShop Analyzer.

    Allow the reordering of functions (subprograms) in the core image using the compiler, the Analyzer and the linker. If you compile with the -xF option, then run the Analyzer, you can generate a map file that optimizes the ordering of the functions in memory depending on how they are used together. A subsequent link to build the executable file can be directed to use that map by using the linker -Mmapfile option. It places each function from the executable file into a separate section.

    Reordering the subprograms in memory is useful only when the application text page fault time is consuming a large percentage of the application time. Otherwise, reordering may not improve the overall performance of the application. The Analyzer is part of the Sun WorkShop. See Using Sun WorkShop and Analyzing Program Performance with Sun WorkShop for further information on the Analyzer.


    -xhelp=h

    Show summary help information on options or README file.

    The h is either readme or flags.

    -xhelp=readme       Show the online README file for this release of the compiler.
    -xhelp=flags          Show the compiler flags (options).

    -xhelp=flags is a synonym for -help.


    -xia[=v]

    Enable interval arithmetic extensions and set a suitable floating-point environment.

    v can be one of either widestneed or strict. The default if not specified is widestneed.

    Fortran 95 extensions for interval arithmetic calculations are detailed in the Interval Arithmetic Programming Reference. See also -xinterval, page 103.

    The -xia flag is a macro that expands as follows

    -xia or
    -xia=widestneed
    -xinterval=widestneed -ftrap=%none -fns=no -fsimple=0
    
    -xia=strict
    
    -xinterval=strict -ftrap=%none -fns=no -fsimple=0
    


    :


    -xildoff

    Turn off the Incremental Linker.

    This forces the use of the standard linker, ld.

    This option is the default if you do not use the -g option. It is also the default if you use -G or name any source file on the command line.

    Override this default by using the -xildon option.


    -xildon

    Turn on the Incremental Linker.

    Turn on the Incremental Linker and force the use of ild in incremental mode.

    This option is the default if you use -g and do not use -G, and no source files appear on the command line (just object files and/or libraries).

    Override this default by using the -xildoff option.

    See the section on ild in the C User's Guide.


    -xinline=list

    Synonym for -inline.


    -xinterval[=v]

    Enable interval arithmetic extensions.

    v can be one of either no, widestneed or strict. The default if not specified is widestneed.

    no
    
    Interval arithmetic extensions not enabled.
    widestneed
    
    Promotes all non-interval variables and literals in any mixed-mode expression to the widest interval data type in the expression.
    strict
    
    Prohibits mixed-type or mixed-length interval expressions. All interval type and length conversions must be explicit.


    Fortran 95 extensions for interval arithmetic calculations are detailed in the Interval Arithmetic Programming Reference. See also -xia, page 101.


    -xl[d]

    Enable more VMS Fortran extensions.

    -xl: Enable the compiler to accept more VMS Fortran extensions. This is a macro that is translated to -vax=misalign, and provides the language features that are listed later in this description. See the description of -vax=, page 90.

    Although most VMS features are accepted automatically by f77 without any special options, you must use the -xl option for a few VMS extensions.

    In general, you need the -xl option if a source statement can be interpreted as either a VMS feature or an f77 or f95 feature, and you want the VMS feature. In this case, the -xl option forces the compiler to interpret it the VMS way.

    This option enables the following VMS language features:

    Use -xl to get VMS alignment if your program has some detailed knowledge of how VMS structures are implemented.

    Use -xld to cause compilation of debugging comments (D or d in column one). Without the -xld option, they remain comments only. (There is no space between -xl and d.)

    Programs that share structures with C routines should not use -xl.

    See the Fortran Library Reference for information on the VMS libraries. See also the chapter on VMS language extensions in the Fortran 77 Language Reference that the f77 compiler automatically recognizes.


    -xlibmil

    Synonym for -libmil.


    -xlibmopt

    Use library of optimized math routines.

    Use selected math routines optimized for speed. This option usually generates faster code. It may produce slightly different results; if so, they usually differ in the last bit. The order on the command line for this library option is not significant.


    xlic_lib=sunperf

    Link with the Sun Performance Library.

    For example:

    f77 -o pgx -fast pgx.f -xlic_lib=sunperf 
    

    As with -l, this option should appear on the command line after all source and object file names.

    This option must be used to link with the Sun Performance Library. (See the Sun Performance Library User's Guide.)


    xlicinfo

    Show license server information.

    Use this option to return license information about the licensing system--in particular, the name of the license server and the user ID for each of the users who have licenses checked out.

    Generally, with this option, no compilation takes place, and a license is not checked out. This option is normally used alone with no other options. However, if a conflicting option is used, then the last one on the command line prevails, and there is a warning.


    -Xlist[x]

    Produce listings and do global program checking (GPC).

    Use this option to find potential programming bugs. It invokes an extra compiler pass to check for consistency in subprogram call arguments, common blocks, and parameters, across the global program. The option also generates a line-numbered listing of the source code, including a cross reference table. The error messages issued by the -Xlist options are advisory warnings and do not prevent the program from being compiled and linked.


    Note – Be sure to correct all syntax errors in the source code before compiling with a -Xlist global program checking output. GPC can produce unpredictable reports when run on a source code with syntax errors.

    Example: Check across routines for consistency:

     demo% f95 -Xlist  fil.f
    

    The above example writes the following to the output file fil.lst:

    By default, the listings are written to the file name.lst, where name is taken from the first listed source file on the command line.

    A number of sub-options provide further flexibility in the selection of actions. These are specified by suffixes to the main -Xlist option, as shown in the following table

    TABLE 3-16   -Xlist Suboptions
    Option Feature
    -Xlist
    
    Show errors, listing, and cross reference table
    -Xlistc
    
    Show call graphs and errors (f77 only)
    -XlistE
    
    Show errors
    -Xlisterr[nnn]
    
    Suppress error nnn messages
    -Xlistf
    
    Show errors, listing, and cross references, but no object files
    -Xlistflndir
    
    Put .fln files in directory dir, which must already exist (f77 only)
    -Xlisth
    
    Terminate compilation if errors detected (f77 only)
    -XlistI
    
    Analyze #include and INCLUDE files as well as source files
    -XlistL
    
    Show listing and errors only
    -Xlistln
    
    Set page length to n lines
    -Xlisto name
    
    Rename report file to name.lst
    -Xlists
    
    Suppress unreferenced names from the cross-reference table (f77 only)
    -Xlistvn
    
    Set checking level to n (1,2,3, or 4) - default is 2 (f77 only)
    -Xlistw[nnn]
    
    Set width of output line to nnn columns - default is 79 (f77 only)
    -Xlistwar[nnn]
    
    Suppress warning nnn messages
    -XlistX
    
    Show cross-reference table and errors


    Options -Xlistc, -Xlistf, -Xlistflndir, -Xlisth, -Xlists, and
    -Xlistvn are not available with f95.

    See the Fortran Programming Guide chapter Program Analysis and Debugging for details.


    -xloopinfo

    Synonym for -loopinfo.


    -xmaxopt[=n]

    Enable optimization pragma and set maximum optimization level.

    n has the value 1 through 5 and corresponds to the optimization levels of -O1 through -O5. If not specified, the compiler uses 5.

    This option enables the C$PRAGMA SUN OPT=n directive (see page 30) when it appears in the source input. Without this option, the compiler treats these lines as comments.

    If such a pragma directive appears with an optimization level greater than the maximum level on the -xmaxopt flag, the compiler uses -xmaxopt level.


    -xmemalign[=<a><b>]

    Specify maximum assumed memory alignment and behavior of misaligned data accesses.

    For memory accesses where the alignment is determinable at compile time, the compiler will generate the appropriate laod/store instruction sequence for that data alignment.

    For memory accesses where the alignment cannot be determined at compile time, the compiler must assume an alignment to generate the needed load/store sequence.

    The -xmemalign flag allows the user to specify the maximum memory alignment of data to be assumed by the compiler for those indeterminable situations. It also specifies the error behavior at runtime when a misaligned memory access does take place.

    The value specified consists of two parts: a numeric alignment value, <a>, and an alphabetic behavior flag, <b>.

    Allowed values for alignment, <a>, are:

    1 Assume at most 1-byte alignment.
    2    Assume at most 2-byte alignment.
    4   Assume at most 4-byte alignment.
    8 Assume at most 8-byte alignment.
    16 Assume at most 16-byte alignment.

    Allowed values for error behavior on accessing misaligned data, <b>, are:

    i Interpret access and continue execution
    s Raise signal SIGBUS
    f Raise signal SIGBUS only for alignments less or equal to 4

    The defaults without -xmemalign specified are:

    The default for -xmemalign appearing without a value is 1i for all platforms.

    The -dalign (page 52) and -misalign (page 71) options are macros:

    -dalign  is a macro for: -xmemalign=8s -aligncommon=8
    -misalign
    is a macro for: -xmemalign=1i -aligncommon=1

    -xnolib

    Synonym for -nolib.


    -xnolibmil

    Synonym for -nolibmil.


    -xnolibmopt

    Do not use fast math library.

    Use with -fast to override linking the optimized math library:

    f77 -fast -xnolibmopt ...


    -xOn

    Synonym for -On.


    -xpad

    Synonym for -pad.


    -xparallel

    Synonym for -parallel.


    -xpg

    Synonym for -pg.


    xpp={fpp|cpp}

    Select source file preprocessor.

    The default is -xpp=fpp.

    The compilers use fpp(1) to preprocess .F or .f95 source files. This preprocessor is appropriate for Fortran. Previous versions used the standard C preprocessor cpp. To select cpp, specify -xpp=cpp.


    -xprefetch[=v]

    Enable prefetch instructions on platforms that support prefetch, such as UltraSPARC II.

    Specifying -xprefetch=yes enables the compiler to insert prefetch instructions whenever appropriate. This may result in a performance improvement on UltraSPARC II processors (-xarch=v8plus, v9plusa, v9, or v9a).

    v, if it appears, must be one or a comma-separated list of the following sub-options:

    -xprefetch= Meaning
    auto
    
    Enable automatic generation of prefetch instructions
    no%auto
    
    Disable automatic generation of prefetch instructions
    explicit
    
    Enable explicit prefetch directives
    no%explicit
    
    Disable explicit prefetch directives
    auto,explicit
    
    Enable both automatic and explicit prefetch modes
    yes
    
    Same as -xprefetch=auto,explicit
    no
    
    Same as -xprefetch=no%auto,no%explicit


    If not specified, the compiler assumes -xprefetch=no. -xprefetch specified by itself defaults to -xprefetch=yes.

    See page 31 for a description of the Fortran PREFETCH directives.


    -xprofile=p

    Collect or optimize with runtime profiling data.

    p must be one of collect[:nm], use[:nm], or tcov. Optimization level must be -O2 or greater.

    collect[:nm]

    Collect and save execution frequency data for later use by the optimizer with -xprofile=use. The compiler generates code to measure statement execution frequency.
    The nm is the name of the program that is being analyzed. This name is optional. If nm is not specified, a.out is assumed to be the name of the executable.
    At runtime a program compiled with -xprofile=collect:nm will create the subdirectory nm.profile to hold the runtime feedback information. Data is written to the file feedback in this subdirectory. If you run the program several times, the execution frequency data accumulates in the feedback file; that is, output from prior runs is not lost.

    use[:nm]

    Use execution frequency data to optimize strategically.
    As with collect:nm, the nm is optional and may be used to specify the name of the program.
    The program is optimized by using the execution frequency data previously generated and saved in the feedback files written by a previous execution of the program compiled with -xprofile=collect.
    The source files and other compiler options must be exactly the same as used for the compilation that created the compiled program that generated the feedback file. If compiled with -xprofile=collect:nm, the same program name nm must appear in the optimizing compilation: -xprofile=use:nm.

    tcov

    Basic block coverage analysis using "new" style tcov.
    Code instrumentation is similar to that of -a, but .d files are no longer generated for each source file. Instead, a single file is generated, whose name is based on the name of the final executable. For example, if stuff is the executable file, then stuff.profile/tcovd is the data file.
    When running tcov, you must pass it the -x option to make it use the new style of data. If not, tcov uses the old .d files, if any, by default for data, and produces unexpected output.
    Unlike -a, the TCOVDIR environment variable has no effect at compile-time. However, its value is used at program runtime to identify where to create the profile subdirectory.
    See the tcov(1) man page, the Performance Profiling chapter of the Fortran Programming Guide, and the Analyzing Program Performance with Sun WorkShop manual for more details.
    Note: The report produced by tcov can be unreliable if there is inlining of subprograms due to -O4 or -inline. Coverage of calls to routines that have been inlined are not recorded.

    -xrecursive

    Allow routines without RECURSIVE attribute call themselves recursively.

    Only subprograms defined with the RECURSIVE attribute can call themselves recursively, unless they are compiled with -xrecursive.

    However, compiling with -xrecursive may cause performance degradations. Also consider using -stackvar with -xrecursive since -xrecursive does not by itself allocate local variables on the memory stack.


    -xreduction

    Synonym for -reduction.


    -xregs=r

    Specify register usage.

    r is a comma-separated list that consists of one or more of the following:

    [no%]appl, [no%]float.

    Where the % is shown, it is a required character.

    Example: -xregs=appl,no%float

    The default is: -xregs=appl,float.


    xs

    Allow debugging by dbx without object (.o) files .

    With -xs, if you move executables to another directory, then you can use dbx and ignore the object (.o) files. Use this option when you cannot keep the .o files.

    Without -xs, if you move the executables, you must move both the source files and the object (.o) files, or set the path with either the dbx pathmap or use command.


    -xsafe=mem

    Assume no memory-based traps.

    Using this option allows the compiler to assume no memory-based traps occur. It grants permission to use the speculative load instruction on V9 machines. It is only effective if -O5 and -xarch=v8plus are also specified.


    -xsb

    Synonym for -sb.


    -xsbfast

    Synonym for -sbfast.


    -xspace

    Do not allow optimizations to increase code size.

    Do no optimizations that increase the code size.

    Example: Do not unroll or parallelize loops if it increases code size.


    -xtarget=t

    Specify target platform for optimization.

    Specify the target platform for the instruction set and optimization.

    t must be one of: native, generic, platform-name.

    The -xtarget option permits a quick and easy specification of the -xarch, -xchip, and -xcache combinations that occur on real platforms. The only meaning of -xtarget is in its expansion.

    The performance of some programs may benefit by providing the compiler with an accurate description of the target computer hardware. When program performance is critical, the proper specification of the target hardware could be very important. This is especially true when running on the newer SPARC processors. However, for most programs and older SPARC processors, the performance gain is negligible and a generic specification is sufficient.

    native: Optimize performance for the host platform.

    The compiler generates code optimized for the host platform. It determines the available architecture, chip, and cache properties of the machine on which the compiler is running.

    generic: Get the best performance for generic architecture, chip, and cache.

    The compiler expands -xtarget=generic to:
    -xarch=generic -xchip=generic -xcache=generic
    This is the default value.

    platform-name: Get the best performance for the specified platform.

    Appendix D gives a complete list of current SPARC platform names accepted by the compilers. For example, -xtarget=ultra2i

    -xtime

    Synonym for -time.


    xtypemap=spec

    Specify default data mappings.

    This option provides a flexible way to specify the byte sizes for default data types. Use of this option is preferred over -dbl and -r8, and applies to both default-size variables and constants.

    The specification string spec may contain any or all of the following in a comma-delimited list:

    real:size
    double:size
    integer:size

    The accepted data size values are: 64, 128, for real and double; 32, 64, and mixed for integer. For example:

    -xtypemap=real:64,double:128,integer:64

    This option applies to all variables declared with default specifications (without explicit byte sizes), as in REAL XYZ (resulting in a 64-bit XYZ). Also, all single-precision REAL constants are promoted to REAL*8.

    The allowable combinations on each platform are:

    The integer:mixed mapping specifies 8-byte data but only 4-byte arithmetic, and is only available with f77. Preferred is integer:64.

    The f77 flags -dbl and -r8 options have their -xtypemap equivalents:

    There are two additional possibilities on SPARC:

    which map both default REAL and DOUBLE to 8 bytes, and may be preferable over the use of -dbl or -r8 because they do not promote DOUBLE PRECISION to QUAD PRECISION.

    Note that INTEGER and LOGICAL are treated the same, and COMPLEX is mapped as two REALs. Also, DOUBLE COMPLEX will be treated the way DOUBLE is mapped.


    -xunroll=n

    Synonym for -unroll=n.


    -xvector[={yes|no}]

    Enable automatic calls to the SPARC vector library functions.

    With -xvector=yes, the compiler is permitted to transform certain math library calls within DO loops into single calls to the equivalent vectorized library routine whenever possible. This could result in a performance improvement for loops with large loop counts.

    The compiler defaults to -xvector=no. Specifying -xvector by itself defaults to -xvector=yes.

    This option also triggers -depend. (Follow -xvector with -nodepend on the command line to cancel the dependency analysis.)

    The compiler will automatically notify the linker to include the libmvec and libc libraries in the load step if -xvector appears. However, to compile and link in separate steps requires specifying -xvector on the link step as well to correctly select these necessary libraries.


    -xvpara

    Synonym for -vpara.


    -Zlp

    Compile for loop performance profiling by looptool.

    Prepare object files for the loop profiler, looptool. The looptool(1) utility can then be run to generate loop statistics about the program.

    If you compile and link in separate steps, and you compile with -Zlp, then be sure to link with -Zlp.

    If you compile one subprogram with -Zlp, you need not compile all the subprograms of that program with -Zlp. However, you receive the loop information only for the files compiled with -Zlp, and no indication that the program includes other files.

    Refer to Analyzing Program Performance With Sun WorkShop for more information.


    -ztext

    Generate only pure libraries with no relocations.

    Do not make the library if relocations remain.

    The general purpose of -ztext is verify that a generated library is pure text; instructions are all position-independent code. Therefore, it is generally used with both -G and -pic.

    With -ztext, if ld finds an incomplete relocation in the text segment, then it does not build the library. If it finds one in the data segment, then it generally builds the library anyway; the data segment is writable.

    Without -ztext, ld builds the library, relocations or not.

    A typical use is to make a library from both source files and object files, where you do not know if the object files were made with -pic.

    Example: Make library from both source and object files:

    demo% f77 -G -pic -ztext -o MyLib -hMyLib a.f b.f x.o y.o
    

    An alternate use is to ask if the code is position-independent already: compile without -pic, but ask if it is pure text.

    Example: Ask if it is pure text already--even without -pic:

    demo% f77 -G -ztext -o MyLib -hMyLib a.f b.f x.o y.o
    

    If you compile with -ztext and ld does not build the library, then you can recompile without -ztext, and ld will build the library. The failure to build with -ztext means that one or more components of the library cannot be shared; however, maybe some of the other components can be shared. This raises questions of performance that are best left to you, the programmer.


    Sun Microsystems, Inc.
    Copyright information. All rights reserved.
    Feedback
    Library   |   Contents   |   Previous   |   Next   |   Index