Compiler options comparison
.. contents::
:local:
This document catalogs the options processed by F18's peers/competitors. Much of the document is taken up by a set of tables that list the options categorized into different topics. Some of the table headings link to more information about the contents of the tables. For example, the table on Standards conformance options links to notes on Standards conformance.
There's also important information in the Appendix section near the end of the document on how this data was gathered and what is and is not included in this document.
Note that compilers may support language features without having an option for them. Such cases are frequently, but not always noted in this document.
Categorisation of Options
Standards conformance | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Overall conformance | en,
eN |
std=level | qlanglvl, qsaa | stand level | Mstandard | Mstandard |
Compatibility with previous standards or implementations | N/A | fdec,
fall-instrinsics |
qxlf77, | f66, | Mallocatable=95|03 | Mallocatable=95|03 |
Source format | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Fixed or free source | f free,
f fixed |
ffree-form,
ffixed-form |
qfree, | fixed, | Mfree,
Mfixed |
Mfreeform,
Mfixed |
Source line length | N col | ffixed-line-length-n,
ffree-line-length-n |
qfixed=n | extend-source [size] | Mextend | Mextend |
Column 1 comment specifier | ed | fd-lines-as-code,
fd-lines-as-comments |
D, | d-lines | Mdlines | N/A |
Don't treat CR character as a line terminator | NA | N/A | qnocr | N/A | N/A | N/A |
Source file naming | N/A | N/A | qsuffix | extfor, | N/A | N/A |
Names, Literals, and other tokens | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Max identifier length | N/A | fmax-identifier-length=n | N/A | N/A | N/A | N/A |
"$" in symbol names | N/A | fdollar-ok | default | default | N/A | N/A |
Allow names with leading "_" | eQ | N/A | N/A | N/A | N/A | N/A |
Specify name format | N/A | N/A | U | names=keyword | Mupcase | NA |
Escapes in literals | N/A | fbackslash | qescape | assume bscc | Mbackslash | Mbackslash |
Allow multibyte characters in strings | N/A | N/A | qmbcs | N/A | N/A | N/A |
Create null terminated strings | N/A | N/A | qnullterm | N/A | N/A | N/A |
Character to use for "$" | N/A | N/A | N/A | N/A | Mdollar,char | |
Allow PARAMETER statements without parentheses | N/A | N/A | N/A | altparam | N?A | N/A |
DO loop handling | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
One trip DO loops | ej | N/A | 1, | f66 | Monetrip | N/A |
Allow branching into loops | eg | N/A | N/A | N/A | N/A | N/A |
REAL, DOUBLE PRECISION, and COMPLEX Data | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Default REAL size | s real32,
s real64, s default32, s default64 |
fdefault-real-[8|10|16] | qrealsize=[4|8] | real-size [32|64|128] | r[4|8] | r8,
fdefault-real-8 |
Default DOUBLE PRECISION size | ep | fdefault-double-8 | N/A | double-size[64|128] | N/A | N/A |
Make real constants DOUBLE PRECISION | N/A | N/A | qdpc | N/A | N/A | N/A |
Promote or demote REAL type sizes | N/A | freal-[4|8]-real[4|8|10|16] | qautodbl=size | N/A | Mr8,
Mr8intrinsics |
N/A |
Rounding mode | N/A | N/A | qieee | assume std_minus0_rounding | N/A | N/A |
Treatment of -0.0 | N/A | N/A | N/A | assume minus0 |
INTEGER and LOGICAL Data | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Default INTEGER size | s integer32,
s integer64, s default32, s default64 |
fdefault-integer-8 | qintsize=[2|4|8] | integer-size [32|64|128] | I[2|4|8],
Mi4, Mnoi4 |
i8,
fdefault-integer-8 |
Promote INTEGER sizes | N/A | finteger-4-integer-8 | N/A | N/A | N/A | N/A |
Enable 8 and 16 bit INTEGER and LOGICALS | eh | N/A | N/A | N/A | N/A | N/A |
Change how the compiler treats LOGICAL | N/A | N/A | N/A | N/A | Munixlogical | |
Treatment of numeric constants as arguments | N/A | N/A | qxlf77 oldboz | assume old_boz | N/A | N/A |
Treatment of assignment between numerics and logicals | N/A | N/A | N/A | assume old_logical_assign | N/A | N/A |
CHARACTER and Pointer Data | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Use bytes for pointer arithmetic | s byte_pointer | N/A | N/A | N/A | N/A | N/A |
Use words for pointer arithmetic | S word_pointer | N/A | N/A | N/A | N/A | N/A |
Allow character constants for typeless constants | N/A | N/A | qctyplss | N/A | N/A | N/A |
Data types and allocation | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Default to IMPLICIT NONE | eI | fimplicit-none | u, qundef | warn declarations | Mdclchk | N/A |
Enable DEC STRUCTURE extensions | N/A | fdec-structure | N/A | N/A | default | N/A |
Enable Cray pointers | default | fcray-pointer | Default (near equivalent) | Default (near equivalent) | Mcray | N/A |
Allow bitwise logical operations on numeric | ee | N/A | qintlog | N/A | N/A | N/A |
Allow DEC STATIC and AUTOMATIC declarations | default | fdec-static | Default, see IMPLICIT STATIC and IMPLICIT AUTOMATIC | Default, see AUTOMATIC and STATIC | Default | N/A |
Allocate variables to static storage | ev | fno-automatic | qsave | save, | Mnorecursive,
Msave |
N/A |
Compile procedures as if RECURSIVE | eR | frecursive | q recur | assume recursion, | Mrecursive | Mrecursive |
Arrays | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Enable coarrays | h caf | fcoarray=key | N/A | coarray[=keyword] | N/A | N/A |
Contiguous array pointers | h contiguous | N/A | qassert=contig | assume contiguous_pointer | N/A | N/A |
Contiguous assumed shape dummy arguments | h contiguous_assumed_shape | frepack-arrays | qassert=contig | assume contiguous_assumed_shape | N/A | N/A |
OpenACC, OpenMP, and CUDA | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Enable OpenACC | h acc | fopenacc | N/A | N/A | acc | N/A |
Enable OpenMP | h omp | fopenmp | qswapomp | qopenmp, |
mp,
Mcuda |
-mp |
Miscellaneous | ||||||
Option | Cray | GNU | IBM | Intel | PGI | Flang |
Disable compile time range checking | N/A | fno-range-check | N/A | N/A | N/A | N/A |
Disable call site checking | dC | N/A | N/A | N/A | N/A | N/A |
Warn for bad call checking | eb | N/A | N/A | N/A | N/A | N/A |
Set default accessibility of module entities to PRIVATE | N/A | fmodule-private | N/A | N/A | N/A | N/A |
Force FORALL to use temp | N/A | ftest-forall-temp | N/A | N/A | N/A | N/A |
Notes
All conformance options are similar -- they issue warnings if non-standard features are used. All defaults are to allow extensions without warnings. The GNU, IBM, and Intel compilers allow multiple standard levels to be specified.
- Cray: The capital "-eN" option specifies to issue error messages for non-compliance rather than warnings.
- GNU: The "std=level" option specifies the standard to which the program is expected to conform. The default value for std is 'gnu', which specifies a superset of the latest Fortran standard that includes all of the extensions supported by GNU Fortran, although warnings will be given for obsolete extensions not recommended for use in new code. The 'legacy' value is equivalent but without the warnings for obsolete extensions. The 'f95', 'f2003', 'f2008', and 'f2018' values specify strict conformance to the respective standards. Errors are given for all extensions beyond the relevant language standard, and warnings are given for the Fortran 77 features that are permitted but obsolescent in later standards. '-std=f2008ts' allows the Fortran 2008 standard including the additions of the Technical Specification (TS) 29113 on Further Interoperability of Fortran with C and TS 18508 on Additional Parallel Features in Fortran. Values for "level" are f_95, f2003, f2008, f2008ts, f2018, gnu,_ and legacy.
Fixed or free source: Cray, IBM, and Intel default the source format based on the source file suffix as follows:
- Cray
- Free: .f90, .F90, .f95, .F95, .f03, .F03, .f08, .F08, .ftn, .FTN
- Fixed: .f, .F, .for, .FOR
- Intel
- Free: .f90, .F90, .i90
- Fixed: .f, .for, .FOR, .ftn, .FTN, .fpp, .FPP, .i
IBM Fortran's options allow the source line length to be specified with the option, e.g., "-qfixed=72". IBM bases the default on the name of the command used to invoke the compiler. IBM has 16 different commands that invoke the Fortran compiler, and the default use of free or fixed format and the line length are based on the command name. -qfixed=72 is the default for the xlf, xlf_r, f77, and fort77 commands. -qfree=f90is the default for the f90, xlf90, xlf90_r, f95, xlf95, xlf95_r, f2003, xlf2003, xlf2003_r, f2008, xlf2008, and xlf2008_r commands. The maximum line length for either source format is 132 characters.
Column 1 comment specifier: All compilers allow "D" in column 1 to specify that the line contains a comment and have this as the default for fixed format source. IBM also supports an "X" in column 1 with the option "-qxlines".
Source line length:
- Cray: The "-N col" option specifies the line width for fixed- and free-format source lines. The value used for col specifies the maximum number of columns per line. For free form sources, col can be set to 132, 255, or 1023. For fixed form sources, col can be set to 72, 80, 132, 255, or 1023. Characters in columns beyond the col specification are ignored. By default, lines are 72 characters wide for fixed-format sources and 255 characters wide for free-form sources.
- GNU: For both "ffixed-line-length-n" and "ffree-line-length-n" options, characters are ignored after the specified length. The default for fixed is 72. The default for free is 132. For free, you can specify 'none' as the length, which means that all characters in the line are meaningful.
- IBM: For fixed, the default is 72. For free, there's no default, but the maximum length for either form is 132.
- Intel: The default is 72 for fixed and 132 for free.
- PGI, Flang:
- in free form, it is an error if the line is longer than 1000 characters
- in fixed form by default, characters after column 72 are ignored
- in fixed form with -Mextend, characters after column 132 are ignored
Names, Literals, and other tokens
Escapes in literals:
- GNU: The "-fbackslash" option the interpretation of backslashes in string literals from a single backslash character to "C-style" escape characters. The following combinations are expanded \a, \b, \f, \n, \r, \t, \v, \, and \0 to the ASCII characters alert, backspace, form feed, newline, carriage return, horizontal tab, vertical tab, backslash, and NUL, respectively. Additionally, \xnn, \unnnn and \Unnnnnnnn (where each n is a hexadecimal digit) are translated into the Unicode characters corresponding to the specified code points. All other combinations of a character preceded by \ are unexpanded.
- Intel: The option "-assume bscc" tells the compiler to treat the backslash character () as a C-style control (escape) character syntax in character literals. "nobscc" specifies that the backslash character is treated as a normal character in character literals. This is the default.
"$" in symbol names: Allowing "$" in names is controlled by an option in GNU and is the default behavior in IBM and Intel. Presumably, these compilers issue warnings when standard conformance options are enabled. Dollar signs in names don't seem to be allowed in Cray, PGI, or Flang.
One trip:
- IBM: IBM has two options that do the same thing: "-1" and "-qonetrip".
- Intel: Intel used to support a "-onetrip" option, but it has been removed. Intel now supports a "-f66" option that ensures that DO loops are executed at least once in addition to several other Fortran 66 semantic features.
REAL, DOUBLE PRECISION, and COMPLEX Data
These size options affect the sizes of variables, literals, and intrinsic function results.
Default REAL sizes: These options do not affect the size of explicitly declared data (for example, REAL(KIND=4).
- Cray: The "-s default32" and "-s default64" options affect both REAL, INTEGER, and LOGICAL types.
Default DOUBLE PRECISION: These options allow control of the size of DOUBLE PRECISION types in conjunction with controlling REAL types.
- Cray: The "-ep" option controls DOUBLE PRECISION. This option can only be enabled when the default data size is 64 bits ("-s default64" or "-s real64"). When "-s default64" or "-s real64" is specified, and double precision arithmetic is disabled, DOUBLE PRECISION variables and constants specified with the D exponent are converted to default real type (64-bit). If double precision is enabled ("-ep"), they are handled as a double precision type (128-bit). Similarly when the "-s default64" or" -s real64" option is used, variables declared on a DOUBLE COMPLEX statement and complex constants specified with the D exponent are mapped to the complex type in which each part has a default real type, so the complex variable is 128-bit. If double precision is enabled ("-ep"), each part has double precision type, so the double complex variable is 256-bit.
- GNU: The "-fdefault-double-8" option sets the DOUBLE PRECISION type to an 8 byte wide type. Do nothing if this is already the default. If "-fdefault-real-8" is given, DOUBLE PRECISION would instead be promoted to 16 bytes if possible, and "-fdefault-double-8" can be used to prevent this. The kind of real constants like 1.d0 will not be changed by "-fdefault-real-8" though, so also "-fdefault-double-8" does not affect it.
Promote or demote REAL type sizes: These options change the meaning of data types specified by declarations of the form REAL(KIND=N), except, perhaps for PGI.
- GNU: The allowable combinations are "-freal-4-real-8", "-freal-4-real-10", "-freal-4-real-16", "-freal-8-real-4", "-freal-8-real-10", and "-freal-8-real-16".
- IBM: The "-qautodbl" option is documented here.
- PGI: The "-Mr8" option promotes REAL variables and constants to DOUBLE PRECISION variables and constants, respectively. DOUBLE PRECISION elements are 8 bytes in length. The "-Mr8intrinsics" option promotes the intrinsics CMPLX and REAL as DCMPLX and DBLE, respectively.
These size options affect the sizes of variables, literals, and intrinsic function results.
Default INTEGER sizes: For all compilers, these options affect both INTEGER and LOGICAL types.
Enable 8 and 16 bit INTEGER and LOGICAL: This Cray option ("-eh") enables support for 8-bit and 16-bit INTEGER and LOGICAL types that use explicit kind or star values. By default ("-eh"), data objects declared as INTEGER(kind=1) or LOGICAL(kind=1) are 8 bits long, and objects declared as INTEGER(kind=2) or LOGICAL(kind=2) are 16 bits long. When this option is disabled ("-dh"), data objects declared as INTEGER(kind=1), INTEGER(kind=2), LOGICAL(kind=1), or LOGICAL(kind=2) are 32 bits long.
Intrinsic functions
GNU is the only compiler with options governing the use of non-standard intrinsics. For more information on the GNU options, see here. All compilers implement non-standard intrinsics but don't have options that affect access to them.
Contiguous array pointers: All vendors that implement this option (Cray, IBM, and Intel) seem to have apply to all pointer targets. Assuming that the arrays that are targeted by the pointers allows greater optimization.
Contiguous assumed shape dummy arguments: Cray and Intel have a separate argument that's specific to assumed shape dummy arguments.
Disable call site checking: This Cray option ("-dC") disables some types of standard call site checking. The current Fortran standard requires that the number and types of arguments must agree between the caller and callee. These constraints are enforced in cases where the compiler can detect them, however, specifying "-dC" disables some of this error checking, which may be necessary in order to get some older Fortran codes to compile. If error checking is disabled, unexpected compile-time or run time results may occur. The compiler by default attempts to detect situations in which an interface block should be specified but is not. Specifying "-dC" disables this type of checking as well.
Warn for bad call checking: This Cray option ("-eb") issues a warning message rather than an error message when the compiler detects a call to a procedure with one or more dummy arguments having the TARGET, VOLATILE or ASYNCHRONOUS attribute and there is not an explicit interface definition.
Appendix
What is and is not included
This document focuses on options relevant to the Fortran language. This includes some features (such as recursion) that are only indirectly related. Options related to the following areas are not included:
- Input/Output
- Optimization
- Preprocessing
- Inlining
- Alternate library definition or linking
- Choosing file locations for compiler input or output
- Modules
- Warning and error messages and listing output
- Data initialization
- Run time checks
- Debugging
- Specification of operating system
- Target architecture
- Assembler generation
- Threads or parallelization
- Profiling and code coverage
Data sources
Here's the list of compilers surveyed, hot linked to the source of data on it. Note that this is the only mention of the Oracle and NAG compilers in this document.
- Cray Fortran Reference Manual version 8.7
- IBM (XLF) version 14.1 -- Compiler Reference, Language Reference
- Intel Fortran version 19.0
- GNU Fortran Compiler version 8.3.0
- NAG Fortran Release 6.2
- Oracle Fortran version 819-0492-10
- PGI -- Compiler Reference version 19.1, Fortran Reference Guide version 17
- Flang -- information from GitHub
This document has been kept relatively small by providing links to much of the information about options rather than duplicating that information. For IBM, Intel, and some PGI options, there are direct links. But direct links were not possible for Cray, GNU and some PGI options.
Many compilers have options that can either be enabled or disabled. Some compilers indicate this by the presence or absence of the letters "no" in the option name (IBM, Intel, and PGI) while Cray precedes many options with either "e" for enabled or "d" for disabled. This document only includes the enabled version of the option specification.
Deprecated options were generally ignored, even though they were documented.