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
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 |
|
Support Fortran 77 extensions and compatibility |
-f77 |
|
Specify path for writing compiled .mod Module files |
-moddir=path |
|
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=path |
|
Show elapsed time for each compilation phase |
-time |
|
Show version number of compiler and its phases |
-V |
|
Verbose messages |
-v |
|
Specify non-standard aliasing situations |
-xalias=list |
|
Compile with multiple processors |
-xjobs=n |
|
Compiled Code: |
||
Add/suppress 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 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 with dbx |
-g |
|
Compile for browsing with source browser |
-sb, -sbfast |
|
Flag use of undeclared variables |
-u |
|
Check C$PRAGMA ASSUME assertions |
-xassume_control=check |
|
Check for stack overflow at runtime |
-xcheck=stkovf |
|
Enable runtime task common check |
-xcommonchk |
|
Compile for Performance Analyzer |
-xF |
|
Generate cross-reference listings |
-Xlistx |
|
Enable debugging without object files |
-xs |
|
Diagnostics: |
||
Flag use of non-standard extensions |
-ansi |
|
Suppress named warning messages |
-erroff= |
|
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 |
|
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 |
-Lpath |
|
Link with library libname.a or libname.so |
-lname |
|
Build runtime library search path into executable |
-Rpath |
|
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 |
|
Specify rounding method for formatted input/output |
-iorounding=mode |
|
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] |
|
Invoke interprocedural optimizations pass |
-xipo[=n] |
|
Set highest optimization level for #pragma OPT |
-xmaxopt[=n] |
|
Compile for post-compilation optimizations |
-xbinopt=prepare |
|
Enable/adjust compiler generated prefetch instructions |
-xprefetch=list |
|
Control automatic generation of prefetch instructions |
-xprefetch_level=n |
|
Enable generation or use of performance profiling data |
-xprofile=p |
|
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: |
||
Enable automatic parallelization of DO loops |
-autopar |
|
Show loop parallelization information |
-loopinfo |
|
Compile for hand-coded multithreaded programming |
-mt |
|
Accept OpenMP API directives and set appropriate environment |
-xopenmp[=keyword] |
|
Recognize reduction operations in loops with automatic parallelization |
-reduction |
|
Verbose parallelization messages |
-vpara |
|
Source Code: |
||
Define preprocessor symbol |
-Dname[=val] |
|
Undefine preprocessor symbol |
-Uname |
|
Accept extended (132 character) source lines |
-e |
|
Apply preprocessor to .F and/or .F90 and .F95 files but do not compile |
-F |
|
Accept Fortran 95 fixed-format input |
-fixed |
|
Preprocess all source files with the fpp preprocessor |
-fpp |
|
Accept Fortran 95 free-format input |
-free |
|
Add directory to include file search path |
-Ipath |
|
Add directory to module search path |
-Mpath |
|
Recognize upper and lower case as distinct |
-U |
|
Tread hollerith as character in actual arguments |
-xhasc={yes|no} |
|
Select preprocessor, cpp or fpp, to use |
-xpp[={fpp|cpp}] |
|
Allow recursive subprogram calls |
-xrecursive |
|
Target Platform: |
||
Specify memory model, 32 or 64 bits. |
-m32 | —m64 |
|
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 |
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
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 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 source code. |
-fixed |
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 |
Expansion |
---|---|
-dalign |
-xmemalign=8s -aligncommon=16 |
-f |
-aligncommon=16 |
-fast |
See description of —fast for complete current expansion. |
-fnonstd |
-fns -ftrap=common |
-xia=widestneed |
-xinterval=widestneed -ftrap=%none -fns=no -fsimple=0 |
-xia=strict |
-xinterval=strict -ftrap=%none -fns=no -fsimple=0 |
-xtarget |
-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.
The following options are provided for backward compatibility with earlier compiler releases, and certain Fortran legacy capabilities.
Table 3–6 Backward Compatibility Options
Action |
Option |
---|---|
Allow assignment to constant arguments. |
–copyargs |
Treat hollerith constant as character or typeless in call argument lists. |
-xhasc[={yes|no}] |
Support Fortran 77 extensions and conventions |
-f77 |
Nonstandard arithmetic—allow nonstandard arithmetic. |
–fnonstd |
Optimize performance for the host system. |
–native |
DO loops—use one trip DO loops. |
–onetrip |
Allow legacy aliasing situations |
-xalias=keywords |
Use of these option flags is not recommended for producing portable Fortran 95 programs.
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 |
Equivalent |
---|---|
-a |
-xprofile=tcov |
-cg89 |
-xtarget=ss2 |
-cg92 |
-xtarget=ss1000 |
-explicitpar |
Use OpenMP parallelization; Sun/Cray parallelization deprecated |
-mp |
Use OpenMP parallelization; Sun/Cray parallelization deprecated |
-native |
-xtarget=native |
-noqueue |
License queueing. No longer needed. |
-p |
Profiling. Use -pg or the Performance Analyzer |
-pic |
-xcode=pic13 |
-PIC |
-xcode=pic32 |
-sb |
No longer needed. |
-sbfast |
No longer needed. |
-silent |
No longer needed. |