2.2 Options controlling Fortran dialect
The following options control the details of the Fortran dialect accepted by the compiler:
-
-ffree-form-ffixed-form - Specify the layout used by the source file. The free form layout was introduced in Fortran 90. Fixed form was traditionally used in older Fortran programs. When neither option is specified, the source form is determined by the file extension.
-fall-intrinsics-
This option causes all intrinsic procedures (including the GNU-specific extensions) to be accepted. This can be useful with
-std=f95to force standard-compliance but get access to the full range of intrinsics available withgfortran. As a consequence,-Wintrinsics-stdwill be ignored and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declaredEXTERNAL. -
-fd-lines-as-code-fd-lines-as-comments -
Enable special treatment for lines beginning with
dorDin fixed form sources. If the-fd-lines-as-codeoption is given they are treated as if the first column contained a blank. If the-fd-lines-as-commentsoption is given, they are treated as comment lines. -fdollar-ok-
Allow ‘
$’ as a valid non-first character in a symbol name. Symbols that start with ‘$’ are rejected since it is unclear which rules to apply to implicit typing as different vendors implement different rules. Using ‘$’ inIMPLICITstatements is also rejected. -fbackslash-
Change 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\0to 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. -fmodule-private-
Set the default accessibility of module entities to
PRIVATE. Use-associated entities will not be accessible unless they are explicitly declared asPUBLIC. -
-ffixed-line-length-n -
Set column after which characters are ignored in typical fixed-form lines in the source file, and through which spaces are assumed (as if padded to that length) after the ends of short fixed-form lines.
Popular values for n include 72 (the standard and the default), 80 (card image), and 132 (corresponding to “extended-source” options in some popular compilers). n may also be ‘
none’, meaning that the entire line is meaningful and that continued character constants never have implicit spaces appended to them to fill out the line.-ffixed-line-length-0means the same thing as-ffixed-line-length-none. -
-ffree-line-length-n -
Set column after which characters are ignored in typical free-form lines in the source file. The default value is 132. n may be ‘
none’, meaning that the entire line is meaningful.-ffree-line-length-0means the same thing as-ffree-line-length-none. -
-fmax-identifier-length=n - Specify the maximum allowed identifier length. Typical values are 31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
-fimplicit-none-
Specify that no implicit typing is allowed, unless overridden by explicit
IMPLICITstatements. This is the equivalent of addingimplicit noneto the start of every procedure. -fcray-pointer- Enable the Cray pointer extension, which provides C-like pointer functionality.
-fopenmp-
Enable the OpenMP extensions. This includes OpenMP
!$ompdirectives in free form andc$omp,*$ompand!$ompdirectives in fixed form,!$conditional compilation sentinels in free form andc$,*$and!$sentinels in fixed form, and when linking arranges for the OpenMP runtime library to be linked in. The option-fopenmpimplies-frecursive. -fno-range-check-
Disable range checking on results of simplification of constant expressions during compilation. For example, GNU Fortran will give an error at compile time when simplifying
a = 1. / 0. With this option, no error will be given andawill be assigned the value+Infinity. If an expression evaluates to a value outside of the relevant range of [-HUGE():HUGE()], then the expression will be replaced by-Infor+Infas appropriate. Similarly,DATA i/Z'FFFFFFFF'/will result in an integer overflow on most systems, but with-fno-range-checkthe value will “wrap around” andiwill be initialized to -1 instead. -fdefault-integer-8-
Set the default integer and logical types to an 8 byte wide type. This option also affects the kind of integer constants like
42. Unlike-finteger-4-integer-8, it does not promote variables with explicit kind declaration. -fdefault-real-8-
Set the default real type to an 8 byte wide type. This option also affects the kind of non-double real constants like
1.0, and does promote the default width ofDOUBLE PRECISIONto 16 bytes if possible, unless-fdefault-double-8is given, too. Unlike-freal-4-real-8, it does not promote variables with explicit kind declaration. -fdefault-double-8-
Set the
DOUBLE PRECISIONtype to an 8 byte wide type. Do nothing if this is already the default. If-fdefault-real-8is given,DOUBLE PRECISIONwould instead be promoted to 16 bytes if possible, and-fdefault-double-8can be used to prevent this. The kind of real constants like1.d0will not be changed by-fdefault-real-8though, so also-fdefault-double-8does not affect it. -finteger-4-integer-8-
Promote all
INTEGER(KIND=4)entities to anINTEGER(KIND=8)entities. IfKIND=8is unavailable, then an error will be issued. This option should be used with care and may not be suitable for your codes. Areas of possible concern include calls to external procedures, alignment inEQUIVALENCEand/orCOMMON, generic interfaces, BOZ literal constant conversion, and I/O. Inspection of the intermediate representation of the translated Fortran code, produced by-fdump-tree-original, is suggested. -
-freal-4-real-8-freal-4-real-10-freal-4-real-16-freal-8-real-4-freal-8-real-10-freal-8-real-16 -
Promote all
REAL(KIND=M)entities toREAL(KIND=N)entities. IfREAL(KIND=N)is unavailable, then an error will be issued. All other real kind types are unaffected by this option. These options should be used with care and may not be suitable for your codes. Areas of possible concern include calls to external procedures, alignment inEQUIVALENCEand/orCOMMON, generic interfaces, BOZ literal constant conversion, and I/O. Inspection of the intermediate representation of the translated Fortran code, produced by-fdump-tree-original, is suggested. -
-std=std -
Specify the standard to which the program is expected to conform, which may be one of ‘
f95’, ‘f2003’, ‘f2008’, ‘gnu’, or ‘legacy’. The default value for std is ‘gnu’, which specifies a superset of the Fortran 95 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, and may be useful for old non-standard programs. The ‘f95’, ‘f2003’ and ‘f2008’ values specify strict conformance to the Fortran 95, Fortran 2003 and Fortran 2008 standards, respectively; 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.
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/Fortran-Dialect-Options.html