NAG Fortran Compiler, Release 6.2: Compiler Options
2.4 Compiler Options
- Increase the length of each fixed source form input line from 72 characters to 132 characters. This has no effect on free source form input.
- (Linux x86-64 only)
Specify the ABI to compile for, either 32 (the 32-bit ABI),
or one of the 64-bit ABIs: 64c or 64t.
The differences between the two 64-bit ABIs are as follows:
ABI Object size represented in Character length represented in -abi=64t 64 bits 32 bits -abi=64c 64 bits 64 bits
Programs compiled with -abi=32 will run on any x86 Linux system; those compiled with any 64-bit ABI will only run on a 64-bit kernel.
The default is -abi=64t. The -abi=64c option is compatible with the ABI used by Intel Fortran.
- (64-bit Intel Mac only) Specify the ABI to compile for, either 32 (the 32-bit ABI) or 64 (the 64-bit ABI). The default is -abi=64.
- (Windows only) Specify the ABI to compile for, either 32 (the 32-bit ABI) or 64 (the 64-bit ABI). The default is -abi=64 on Windows x64; on 32-bit Windows the default is -abi=32 and the -abi=64 option is not available.
- (Mac OS X only)
Specify the alignment of variables and components, which must be one of:
natural (natural alignment for best performance; this can alter the interpretation of COMMON block or SEQUENCE type layout in a non-standard-conforming manner), or standard (use standard-conforming alignment; this is the default).
The whole program should be compiled with the same alignment option.
- Specify static or dynamic binding. This only has effect if specified during the link phase. The default is dynamic binding. On SPARC and SG/Irix, these options are positional and can be used to selectively bind some libraries statically and some dynamically. This option is not available on IBM z9 Open Edition.
- Compile only (produce .o file for each source file), do not link the .o files to produce an executable file. This option is equivalent to -otype=obj.
- Compile with all but the most expensive runtime checks; this omits the -C=alias, -C=dangling, -C=intovf and -C=undefined options.
- Compile checking code according to the value of check,
which must be one of:
alias (check for assignments to aliased dummy arguments), all (perform all checks except for -C=undefined), array (check array bounds), bits (check bit intrinsic arguments), calls (check procedure references), dangling (check for dangling pointers), do (check DO loops for zero step values and illicit modification of the index variable via host association), intovf (check for integer overflow), none (do no checking: this is the default), present (check OPTIONAL references), pointer (check POINTER references), recursion (check for invalid recursion) or undefined (check for undefined variables).
The -C=alias option will produce a runtime error when it is detected that assignment to a dummy argument affects another dummy argument. At this release this is only detected for scalar dummy arguments.
The -C=dangling option will produce a runtime error when a dangling pointer is used; additionally, if the runtime option ‘show_dangling’ is set, a warning will be produced at the time the pointer becomes dangling (see Runtime Environment Variables for further information).
The -C=undefined option is subject to a number of limitations; in particular, it is not binary compatible with Fortran code compiled without that option, and is not compatible with calling C code via a BIND(C) interface. See the Undefined Variable Detection section for further details.
- Colour the message output from the compiler using ANSI escape sequences and the default foreground colouring scheme which is: red for error messages (including fatal errors), blue for warning messages and green for information messages.
- Colour the message output from the compiler according to the specified
This is a comma-separated list of colour specifications, each consisting of a
message category name (“error”, “warn” or “info”) followed
by a colon and the foreground colour name, optionally followed by a plus sign
and the background colour name.
The colouring for unspecified categories will be the default.
Colours are: black, red, green, yellow, blue, magenta, cyan and white.
would be a rather garish colour scheme.
- Make external linkages compatible with other compilers where possible; on Windows this is Microsoft Fortran (32-bit mode) or Intel Fortran (64-bit mode), on Mac OSX and Linux this is g77, g95 and gfortran, and on other systems this is the operating system vendor's compiler. This affects the naming convention and procedure calling convention (for example, on Windows it causes use of the “STDCALL” calling convention that is commonly used for most DLLs, and the names are in upper case with no added trailing underscore). On Windows in 64-bit mode, -compatible is always in effect.
- Set the default conversion mode for unformatted files to format.
This format may be overridden by an explicit CONVERT= specifier in the
OPEN statement, or by the environment variable FORT_CONVERTn
(where n is the unit number).
The value of format must be one of the following (not case-sensitive):
Format Description BIG_ENDIAN synonym for BIG_IEEE BIG_IEEE_DD big-endian with IEEE floating-point, quad precision is double-double BIG_IEEE big-endian with IEEE floating-point, including quad precision BIG_NATIVE big-endian with native floating-point format LITTLE_ENDIAN synonym for LITTLE_IEEE LITTLE_IEEE_DD little-endian with IEEE floating-point, quad precision is double-double LITTLE_IEEE little-endian with IEEE floating-point, including quad precision LITTLE_NATIVE little-endian with native floating-point format NATIVE no conversion (the default)
- Defines name to fpp as a preprocessor variable. This only affects files that are being preprocessed by fpp.
- In fixed form only, accept lines beginning with “D” as normal Fortran statements, replacing the D with a space. Without this option, such lines are treated as comments.
- Enable recognition of non-standard double precision complex intrinsic
functions. These act as specific versions of the standard generic intrinsics
Non-standard Equivalent Standard Fortran Generic Intrinsic Function CDABS(A) ABS(A) DCMPLX(X,Y) CMPLX(X,Y,KIND=KIND(0d0)) DCONJG(Z) CONJG(Z) DIMAG(Z) AIMAG(Z) DREAL(Z) REAL(Z) or DBLE(Z)
- Double the size of default INTEGER, LOGICAL, REAL and COMPLEX. Entities specified with explicit kind numbers or byte lengths are unaffected. If quadruple precision REAL is available, the size of DOUBLE PRECISION is also doubled.
- Show but do not execute commands constructed by the compiler driver.
- Allows the compilation and execution of “legacy” software by downgrading the category of common errors found in such software from “Error” to “Warning” (which may then be suppressed entirely with the -w option). This option disables -C=calls, and also enables Hollerith i/o (see the -hollerith_io option).
- Specifies that the encoding system of the Fortran source files is charset, which must be one of ISO_Latin_1, Shift_JIS or UTF_8. If this option is not specified, the default encoding is UTF-8 for Fortran source files that begin with a UTF-8 Byte Order Mark, and ISO Latin-1 (if the language setting is English) or Shift-JIS (if the language setting is Japanese) for other Fortran source files.
- Produce compiler messages in English (default).
- Preprocess only, do not compile. Each file that is preprocessed will produce an output file of the same name with the suffix replaced by .f, .f90 or .f95 according to the suffix of the input file. This option is equivalent to -otype=Fortran.
- Use the Fortran 77/90 version of the SIGN intrinsic instead of the Fortran 95 one (they differ in the treatment of negative zero).
- Specify that the base language is Fortran 95. This only affects extension message generation (Fortran 2003 and 2008 features will be reported as extensions).
- Specify that the base language is Fortran 2003. This only affects extension message generation (Fortran 2008 features will be reported as extensions).
- Specify that the base language is Fortran 2008. This is the default.
- Interpret all Fortran source files according to fixed-form rules.
- (Gnu C based systems only) Do not store floating-point variables in registers on machines with floating-point registers wider than 64 bits. This can avoid problems with excess precision.
- Preprocess the source files using fpp even if the suffix would normally indicate an ordinary Fortran file.
- -framework f
- (Mac OS X only) Use framework f during linking.
- Interpret all Fortran source files according to free-form rules.
- Produce information for interactive debugging by the host system debugger.
- Produce debugging information for dbx90, a Fortran 90 aware front-end to the host system debugger. This produces a debug information (.g90) file for each Fortran source file. This option must be specified for both compilation and linking.
- Enables automatic garbage collection of the executable program. This option must be specified for both compilation and linking, and is unavailable on IBM z9 OpenEdition and x64 Mac and Windows. It is incompatible with the -thread_safe and -mtrace options. For more details see the Automatic Garbage Collection section.
- Compile code to produce a traceback when a runtime error message is generated.
Only routines compiled with this option will appear in such a traceback.
This option increases both executable file size and execution time.
It is incompatible with the -thread_safe and
Runtime Error: Invalid input for real editing Program terminated by I/O error on unit 5 (Input_Unit,Formatted,Sequential) main.f90, line 28: Error occurred in READ_DATA main.f90, line 57: Called by READ_COORDS main.f90, line 40: Called by INITIAL main.f90, line 13: Called by $main$
- Display a one-line summary of the options available for the current mode (=compiler, =callgraph, =depend, =epolish, =interfaces, =polish or =unifyprecision).
- Enable Fortran-66 compatible input/output of character data stored in numeric variables using the A edit descriptor. This was superseded by the CHARACTER datatype in Fortran 77.
- -I pathname
- Add pathname to the list of directories which are to be searched for module information (.mod) files and INCLUDE files. The current working directory is always searched first, then any directories named in -I options, then the compiler's library directory (see the -Qpath option).
- Set the size of default INTEGER and LOGICAL to 64 bits.
This can be useful for switching between libraries that have 32-bit integer
arguments (on one platform) and 64-bit integer arguments (on another platform),
but which do not provide a named constant with the necessary KIND value.
This has no effect on default REAL and COMPLEX sizes, so the compiler is not standard-conforming in this mode.
- -indirect file
- Read the contents of file as additional arguments to the compiler driver.
This option may also be given by “@file”; note in this case there
is no space between the ‘@’ and the file name.
In an indirect file, arguments may be given on separate lines; on a single line, multiple arguments may be separated by blanks. A blank can be included in an option or file name by putting the whole option or file name in quotes ("); this is the only quoting mechanism. An indirect file may reference other indirect files.
- Set the mode of IEEE arithmetic operation according to mode,
which must be one of full, nonstd or stop.
- enables all IEEE arithmetic facilities including non-stop arithmetic.
- Disables non-stop arithmetic, terminating execution on floating overflow, division by zero or invalid operand. If the hardware supports it, this also disables IEEE gradual underflow, producing zero instead of a denormalised number; this can improve performance on some systems.
- enables all IEEE arithmetic facilities except for non-stop arithmetic; execution will be terminated on floating overflow, division by zero or invalid operand.
The -ieee option must be specified when compiling the main program unit, and its effect is global. The default mode is -ieee=stop. For more details see the IEEE 754 Arithmetic Support section. This option is not available on IBM z9 Open Edition with hexadecimal floating point.
- Request output of information messages. The default is to suppress these messages.
- Specify the kind numbering system to be used; option must be one of
byte, sequential or unique.
For -kind=byte, the kind numbers for INTEGER, REAL and LOGICAL will match the number of bytes of storage (e.g., default REAL is 4 and DOUBLE PRECISION is 8). Note that COMPLEX kind numbers are the same as its REAL components, and thus half of the total byte length in the entity.
For -kind=sequential (the default), the kind numbers for all datatypes are numbered sequentially from 1, increasing with precision (e.g., default REAL is 1 and DOUBLE PRECISION is 2).
For -kind=unique, the kind numbers are unique across all data types, so that a kind number for one data type cannot be accidentally used for another data type (except that COMPLEX and REAL are still the same). These kind numbers are all greater than 100 so do not match byte sizes either.
This option does not affect the interpretation of byte-length specifiers (an extension to Fortran 77).
- Link with library libx.a. The linker will search for this library in the directories specified by -Ldir options followed by the normal system directories (see the ld(1) command).
- Add dir to the list of directories for library files (see the ld(1) command).
- Produce module information files (.mod files) only. This option is equivalent to -otype=mod.
- Set the maximum number of simultaneously active host instances of an internal procedure that is being passed as an actual argument, or assigned to a procedure pointer, to N. The default maximum is normally 30, and increased to 160 if either the -openmp or -thread_safe options are used.
- Set the maximum size of a PARAMETER to N MB (megabytes). N must be in the range 1 to 1048576 (1MB to 1TB); the default is 50 MB.
- Increase the limit on the number of continuation lines from 255 to N. This option will not decrease the limit below the standard number.
- -mdir dir
- Write any module information (.mod) files to directory dir instead of the current working directory.
- Set the encoding scheme for compiler messages to charset, which must be one of ISO_Latin_1, Shift_JIS or UTF_8 (not case-sensitive). The -message_encoding=ISO_Latin_1 option is incompatible with the -nihongo option. The default message encoding is Shift_JIS on Windows and UTF_8 on other systems.
- Downgrade consistency checking of procedure argument lists so that mismatches produce warning messages instead of error messages. This only affects calls to a routine which is not in the current file; calls to a routine in the file being compiled must still be correct. This option disables -C=calls.
- Further downgrade consistency checking of procedure argument lists so that calls to routines in the same file which are incorrect will produce warnings instead of error messages. This option disables -C=calls.
- Trace memory allocation and deallocation. This option is a synonym for -mtrace=on.
- Trace memory allocation and deallocation according to the value of
which must be a comma separated list of one or more of:
address (display addresses), all (all options except for off), line (display file/line info if known), off (disable tracing output), on (enable tracing output), paranoia (protect memory allocator data structures against the user program), size (display size in bytes) or verbose (all options except for off and paranoia ).
This option should be specified during both compilation and linking, and is incompatible with the -gc option. For more details see the Memory Tracing section. The -mtrace=paranoia option is not available on IBM z9 Open Edition.
- Initialise REAL and COMPLEX variables to IEEE Signalling NaN, causing a runtime crash if the values are used before being set. This affects local variables, module variables, and INTENT(OUT) dummy arguments only; it does not affect variables in COMMON or EQUIVALENCE. This option is not available on IBM z9 Open Edition with hexadecimal floating point.
- Produce compiler messages in Japanese (if necessary, the encoding can be changed by the -message_encoding= option). This option is not available on IBM z9 Open Edition.
- Suppress the warning message that normally appears if a floating-point underflow occurred during execution. This option is only effective if specified during the link phase.
- Do not check for .mod files being out of date.
- Suppress module information (.mod) file production. Combining this with -M will produce no output (other than error and warning messages) at all, equivalent to -otype=none.
- If no licence for the compiler is immediately available, exit with an error instead of queueing for it.
- Set the expected number of images the program will run with to N, which should be a number in the range 1 to 1000, or ‘unknown’. This only affects analysis of constant cosubscripts: if N is numeric, and they evaluate to an image index greater than N, an error will be produced. The default is -num_images=1.
- -o output
- Name the output file output instead of the default. If an executable is being produced the default is a.out; otherwise it is file.o with the -c option, file.c with the -S option, and file.f, file.f90 or file.f95 with the -F option, where file is the base part of the source file (i.e. with the suffix removed).
- Normal optimisation, equivalent to -O2.
- Set the optimisation level to N.
The optimisation levels are:
- No optimisation. This is the default, and is recommended when debugging.
- Minimal quick optimisation.
- Normal optimisation.
- Further optimisation.
- Maximal optimisation.
- This is a synonym for -Oassumed=contig.
- Optimises assumed-shape array dummy arguments according to the value of
which must be one of
- Optimised for contiguous actual arguments. If the actual argument is not contiguous a runtime error will occur (the compiler is not standard-conforming under this option).
- Optimised for contiguous actual arguments; if the actual argument is not contiguous (i.e. it is an array section) a contiguous local copy is made. This may speed up array section accessing if a sufficiently large number of array element or array operations is performed (i.e. if the cost of making the local copy is less than the overhead of discontiguous array accesses), but usually makes such accesses slower. Note that this option does not affect dummy arguments with the TARGET attribute; these are always accessed via the dope vector.
- Optimised for low-moderate accesses to array section (discontiguous) actual arguments. This is the default.
Note that CHARACTER arrays are not affected by these options.
- Specify the dimension of the blocks used for evaluating the MATMUL intrinsic. The default value (only for -O1 and above) is system and datatype dependent.
- Disable the optimisation of constant propagation. This is the default for -O1 and lower.
- Enable the optimisation of constant propagation. This is the default for -O2 and higher.
- Specify that the program does not alter the default rounding mode. This enables the use of faster code for the ANINT intrinsic.
- Specify the depth to which simple loops and array operations should be unrolled. The default is no unrolling (i.e. a depth of 1) for -O0 and -O1, and a depth of 2 for -O and higher optimisation levels. It can be advantageous to disable the Fortran compiler's loop unrolling if the C compiler normally does a very good job itself — this can be accomplished with -Ounroll=1.
- Perform possibly unsafe optimisations that may depend on the numerical stability of the program. On IBM z9 Open Edition this option, in conjunction with -O4, passes NOSTRICT to the C compiler.
- Recognise OpenMP directives and link with the OpenMP support library. For more details see the OpenMP Support section.
- Specify the type of output file required to filetype, which must be one of
c (C source file), exe (executable file), fortran (Fortran source file), mod (module information file), none (no output file), obj (object file).
The -c, -F and -M options are equivalent to -otype=obj, -otype=Fortran and -otype=mod respectively.
- Compile code to generate profiling information which is written at run-time to an implementation-dependent file (usually gmon.out or mon.out). An execution profile may then be generated using gprof. This option must be specified for compilation and linking and may be unavailable on some implementations.
- Produce position-independent code (small model), for use in a shared library. If the shared library is too big for the small model, use -PIC. This option is not available on IBM z9 Open Edition.
- Produce position-independent code (large model), for use in a shared library. This option is not available on IBM z9 Open Edition.
- -Qpath pathname
- Change the compiler library pathname from its default location to pathname. (The default location on Unix is usually ‘/usr/local/lib/NAG_Fortran’ or ‘/opt/NAG_Fortran/lib’) This option is unnecessary on Windows as the installed location is automatically detected.
- Double the size of default REAL and COMPLEX, and on machines for
which quadruple-precision floating-point arithmetic is available, double the
size of DOUBLE PRECISION (and the non-standard DOUBLE COMPLEX).
REAL or COMPLEX specified with explicit KIND numbers or
byte lengths are unaffected — but since the KIND intrinsic returns the
correct values, COMPLEX(KIND(0d0)) on a machine with quad-precision
floating-point will correctly select quad-precision COMPLEX.
This has no effect on INTEGER sizes, and so the compiler is not standard-conforming in this mode.
Note: This option has been superseded by the -double option which doubles the size of all numeric data types.
- Strip symbol table information from the executable file. This option is only effective if specified during the link phase.
- Produce assembler (actually C source code). The resulting .c file should be compiled with the NAG Fortran compiler, not with the C compiler directly. This option is equivalent to -otype=c.
- This is equivalent to inserting the SAVE statement in all subprograms which are not pure and not declared RECURSIVE, thus causing all non-automatic local variables in such subprograms to be statically allocated. It has no effect on variables in BLOCK constructs.
- Produce obsolescence warning messages for use of ‘CHARACTER*’ syntax. This message is not produced by default since many programs contain this syntax.
- Specify the machine for which code should be generated and optimised.
For x86-32 (x86-compatible 32-bit mode compilation on Linux, MacOSX and
Windows), machine may be one of
i486, i586, i686, pentium2, pentium3, pentium4, prescott the specified Intel processor, k6, k6-2, k6-3, k6-4, athlon, athlon-4, athlon-xp, athlon-mp the specified AMD processor, pentium (equivalent to i586) or pentiumpro (equivalent to i686).
The default is to compile for pentium4 on Linux and MacOSX, and prescott on Windows.
- For x86-64 (x86-compatible 64-bit mode compilation on Linux, MacOSX and Windows), machine may be either athlon64 or nocona.
For Sun/SPARC, machine may be one of
- SPARCstation 1 et al,
- SPARCstation 2 et al,
- UltraSPARC or
- the current machine.
The default is to compile for SPARC V7.
Note that programs compiled for later versions of the architecture may not run, or may run much more slowly, on an earlier machine. The -target=native option is not available with gcc.
For HP9000/700, machine may be one of
- the specified revision of the PA-RISC architecture (default) or
- the current machine.
- For x86-32 (x86-compatible 32-bit mode compilation on Linux, MacOSX and Windows), machine may be one of
- -tempdir directory
- Set the directory used for the compiler's temporary files to directory. The default is to use the directory named by the TMPDIR environment variable, or if that is not set, /tmp on Unix-like systems and the Windows temporary folder on Windows.
- Compile code for safe execution in a multi-threaded environment. This must be specified when compiling and also during the link phase. It is incompatible with the -gc and -gline options.
- Report execution times for the various compilation phases.
- Specify that IMPLICIT NONE is in effect by default, unless overridden by explicit IMPLICIT statements.
- Specify default sharing of NONE in OpenMP PARALLEL and TASK constructs (including in combined constructs such as PARALLELDO). This has the same effect as the DEFAULT(NONE) clause, unless overridden by an explicit DEFAULT(...) directive.
- Bind with the unshared (static) version of the Fortran runtime system; this allows a dynamically linked executable to be run on systems where the NAG Fortran Compiler is not installed. This option is only effective if specified during the link phase.
- Verbose. Print the name of each file as it is compiled.
- Print version information about the compiler.
- Suppress all warning messages. This option is a synonym for -w=all.
- Suppress the warning messages specified by class, which must be one of
all, alloctr, obs, ques, uda, uei, uep,
uip, ulv, unreffed, unused, uparam, usf,
usy, x77 or x95.
- suppresses all warning messages;
- suppresses warning messages about the use of allocatable components, dummy arguments and functions;
- suppresses warning messages about the use of obsolescent features;
- suppresses warning messages about questionable usage;
- suppresses warning messages about unused dummy arguments;
- suppresses warning messages about unused explicit imports;
- suppresses warning messages about unused external procedures;
- suppresses warning messages about unused intrinsic procedures;
- suppresses warning messages about unused local variables;
- suppresses warning messages about variables set but never referenced;
- suppresses warning messages about unused entities — this is equivalent to ‘-w=uda -w=uei -w=uep -w=uip -w=ulv -w=uparam -w=usf -w=usy’;
- suppresses warning messages about unused PARAMETERs;
- suppresses warning messages about unused statement functions;
- suppresses warning messages about unused symbols;
- suppresses extension warnings for obsolete but common extensions to Fortran 77 — these are TAB format, byte-length specifiers, Hollerith constants and D lines;
- suppresses extension warnings for extensions to modern Fortran (not just Fortran 95) that are not part of any Fortran standard.
- The -W
option can be used to specify the path to use for a compilation component or
to pass an option directly to such a component.
The possible combinations are:
- Specify the path used for the Fortran Compiler front-end. Note that this does not affect the library directory; the -Qpath option should be used to specify that.
- Specify the path to use for invoking the C compiler; this is used both for the final stage of compilation and for linking.
- Pass option directly to the host C compiler when compiling (producing the .o file). Multiple options may be specified in a single -Wc, option by separating them with commas.
- Specify the path to use for invoking the linker (producing the executable).
- Pass option directly to the host C compiler when linking (producing the executable). Multiple options may be specified in a single -Wl, option by separating them with commas. A comma may be included in an option by repeating it, e.g. -Wl,-filelist=file1,,file2,,file3 becomes the linker option -filelist=file1,file2,file3.
- Specify the path to use for invoking the fpp preprocessor.
- Pass option directly to fpp when preprocessing.
- Produce additional warning messages specified by class, which must be one
of allocation or reallocation.
- warn if an intrinsic assignment might cause allocation of the variable (or a subcomponent thereof) being assigned to;
- warn if an image selector has constant cosubscripts;
- warn if an intrinsic assignment might cause reallocation of an already-allocated variable (or a subcomponent thereof) being assigned to;
- warn if an intrinsic operation or function with normal operands produces a subnormal result (reduced precision, less than TINY(...)).
Reallocation only occurs when the shape of an array, the value of a deferred type parameter, or the dynamic type (if polymorphic), differs between the variable (or subcomponent) and the expression (or the corresponding subcomponent). Allocation can occur also when the variable (or subcomponent) is not allocated prior to execution of the assignment (except for broadcast assignment). Note that -Warn=allocation thus subsumes -Warn=reallocation.
- Specify a list of external procedures for which to suppress argument data type and arrayness consistency checking. The procedure names should be separated by commas, e.g. -wmismatch=p_one,p2. Unlike the -mismatch option, this only affects data type and arrayness checking, and no warning messages are produced.
- Report on the availability of licences for the compiler instead of compiling anything. Also report the exact version of Kusari being used.
- (Sun/SPARC option only) Store the symbol tables in the executable (otherwise debugging is only possible if the object files are kept).