Sun Studio 12: Fortran User's Guide

3.3 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.

Note that not all options are available on both SPARC and x64/x86 platforms. Check the detailed reference section for availability.

The following table summarizes the 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


Option Flag  

Compilation Mode:


Compile only; do not produce an executable file 



Show commands built by the driver but do not compile 



Support Fortran 77 extensions and compatibility 



Specify path for writing compiled .mod Module files



Specify name of object, library, or executable file to write 

-o filename


Compile and generate only assembly code 



Strip symbol table from executable 



Suppress compiler messages, except error messages 



Define path to directory for temporary files 



Show elapsed time for each compilation phase 



Show version number of compiler and its phases 



Verbose messages 



Specify non-standard aliasing situations 



Compile with multiple processors 


Compiled Code:


Add/suppress trailing underscores on external names 



Inline specified user functions 



Compile position independent code 



Inline certain math library routines 



STOP returns integer status value to shell 



Specify code address space 



Enable prefetch instructions 



Specify use of optional registers 



Specify default data mappings 


Data Alignment:


Specify alignment of data in COMMON blocks 



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



Force alignment of all data on 8-byte boundaries 



Align COMMON block data on 8-byte boundaries 



Specify memory alignment and behavior 




Enable runtime subscript range checking 



Compile for debugging with dbx



Compile for browsing with source browser 

-sb, -sbfast


Flag use of undeclared variables 



Check C$PRAGMA ASSUME assertions



Check for stack overflow at runtime 



Enable runtime task common check 



Compile for Performance Analyzer 



Generate cross-reference listings 



Enable debugging without object files 




Flag use of non-standard extensions 



Suppress named warning messages 



Display error tag names with error messages 



Show summary of compiler options 

-flags, -help


Show version number of the compiler and its phases 



Verbose messages 



Verbose parallelization messages 



Show/suppress warning messages 



Display compiler README file 




Show license server information 


Linking and Libraries:


Allow/require dynamic/static libraries 



Allow only dynamic/static library linking 

-dy, -dn


Build a dynamic (shared object) library 



Assign name to dynamic library 



Add directory to library search path 



Link with library libname.a or



Build runtime library search path into executable 



Disable use of incremental linker, ild



Link with optimized math library 



Link with Sun Performance Library 



Link editor option 



Generate pure libraries with no relocations 


Numerics and Floating-Point:


Use non-standard floating-point preferences 



Select SPARC non-standard floating point 



Enable runtime floating-point overflow during input 



Select IEEE floating-point rounding mode 



Select floating-point optimization level 



Select floating-point trapping mode 



Specify rounding method for formatted input/output 



Promote single precision constants to double precision 



Enable interval arithmetic and set the appropriate floating-point environment (includes -xinterval)



Enable interval arithmetic extensions 


Optimization and Performance:


Analyze loops for data dependencies 



Optimize using a selection of options 



Specify optimization level 



Pad data layout for efficient use of cache 



Allocate local variables on the memory stack 



Enable loop unrolling 



Enable optimization across source files 



Invoke interprocedural optimizations pass 



Set highest optimization level for #pragma OPT



Compile for post-compilation optimizations 



Enable/adjust compiler generated prefetch instructions 



Control automatic generation of prefetch instructions 



Enable generation or use of performance profiling data 



Assert that no memory-based traps will occur 



Do no optimizations that increase code size 



Generate calls to vector library functions automatically 




Enable automatic parallelization of DO loops 



Show loop parallelization information 



Compile for hand-coded multithreaded programming 



Accept OpenMP API directives and set appropriate environment 



Recognize reduction operations in loops with automatic parallelization 



Verbose parallelization messages 


Source Code:


Define preprocessor symbol 



Undefine preprocessor symbol 



Accept extended (132 character) source lines 



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



Accept Fortran 95 fixed-format input 



Preprocess all source files with the fpp preprocessor



Accept Fortran 95 free-format input 



Add directory to include file search path 



Add directory to module search path 



Recognize upper and lower case as distinct 



Tread hollerith as character in actual arguments 



Select preprocessor, cpp or fpp, to use



Allow recursive subprogram calls 


Target Platform:


Specify memory model, 32 or 64 bits. 

-m32 | —m64


Specify target platform instruction set for the optimizer 



Specify target cache properties for optimizer 



Specify target processor for the optimizer 



Specify target platform for the optimizer 


3.3.1 Commonly Used Options

The compiler has 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



Debug—global program checking across routines for consistency of arguments, commons, and so on. 


Debug—produce additional symbol table information to enable the dbx and debugging.


Performance—invoke the optimizer to produce faster running programs. 


Performance—Produce efficient compilation and run times for the native platform, using a set of predetermined options. 


Dynamic (–Bdynamic) or static (–Bstatic) library binding.


Compile only—Suppress linking; make a .o file for each source file.


Output file—Name the executable output file nm instead of a.out.

–o nm

Source code—Compile fixed format Fortran source code. 


3.3.2 Macro Flags

Some option flags are macros that expand into a specific set of other flags. These are provided as a convenient way to specify a number of options that are usually expressed together to select a certain feature.

Table 3–5 Macro Option Flags

Option Flag  



-xmemalign=8s -aligncommon=16




See description of —fast for complete current expansion.


-fns -ftrap=common


-xinterval=widestneed -ftrap=%none -fns=no -fsimple=0


-xinterval=strict -ftrap=%none -fns=no -fsimple=0


-xarch=a -xcache=b -xchip=c

Settings that follow the macro flag on the command line override or add to the the expansion of the macro.

3.3.3 Backward Compatibility and Legacy Options

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

Table 3–6 Backward Compatibility Options



Allow assignment to constant arguments. 


Treat hollerith constant as character or typeless in call argument lists. 


Support Fortran 77 extensions and conventions 


Nonstandard arithmetic—allow nonstandard arithmetic. 


Optimize performance for the host system. 


DO loops—use one trip DO loops.


Allow legacy aliasing situations 


Use of these option flags is not recommended for producing portable Fortran 95 programs.

3.3.4 Obsolete Option Flags

The following options are considered obsolete and should not be used. They might be removed from later releases of the compiler.

Table 3–7 Obsolete f95 Options

Option Flag  









Use OpenMP parallelization; Sun/Cray parallelization deprecated 


Use OpenMP parallelization; Sun/Cray parallelization deprecated 




License queueing. No longer needed. 


Profiling. Use -pg or the Performance Analyzer






No longer needed. 


No longer needed. 


No longer needed.