SysTutorials

Linux Manual Pages › Section 1

gfortran-8(1)

NAME

gfortran – GNU Fortran compiler

SYNOPSIS

gfortran [-c|-S|-E]
         [-g] [-pg] [-Olevel]
         [-Wwarn…] [-pedantic]
         [-Idir…] [-Ldir…]
         [-Dmacro[=defn]…] [-Umacro]
         [-foption…]
         [-mmachine-option…]
         [-o outfile] infile…

Only the most useful options are listed here; see below for the remainder.

DESCRIPTION

The gfortran command supports all the options supported by the gcc command. Only options specific to GNU Fortran are documented here.

All GCC and GNU Fortran options are accepted both by gfortran and by gcc (as well as any other drivers built at the same time, such as g++), since adding GNU Fortran to the GCC distribution enables acceptance of GNU Fortran options by all of the relevant drivers.

In some cases, options have positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default.

OPTIONS

Here is a summary of all the options specific to GNU Fortran, grouped by type. Explanations are in the following sections.

Fortran Language Options
-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code -fd-lines-as-comments -fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -fdefault-real-10 -fdefault-real-16 -fdollar-ok -ffixed-line-length-n -ffixed-line-length-none -ffree-form -ffree-line-length-n -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 -fmax-identifier-length -fmodule-private -ffixed-form -fno-range-check -fopenacc -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 -freal-8-real-10 -freal-8-real-16 -freal-8-real-4 -std=std -ftest-forall-temp
Preprocessing Options
-A-question[=answer] -Aquestion=answer -C -CC -Dmacro[=defn] -H -P -Umacro -cpp -dD -dI -dM -dN -dU -fworking-directory -imultilib dir -iprefix file -iquote -isysroot dir -isystem dir -nocpp -nostdinc -undef
Error and Warning Options
-Waliasing -Wall -Wampersand -Wargument-mismatch -Warray-bounds -Wc-binding-type -Wcharacter-truncation -Wconversion -Wdo-subscript -Wfunction-elimination -Wimplicit-interface -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only -Wintrinsics-std -Wline-truncation -Wno-align-commons -Wno-tabs -Wreal-q-constant -Wsurprising -Wunderflow -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all -Wfrontend-loop-interchange -Wtarget-lifetime -fmax-errors=n -fsyntax-only -pedantic -pedantic-errors
Debugging Options
-fbacktrace -fdump-fortran-optimized -fdump-fortran-original -fdump-parse-tree -ffpe-trap=list -ffpe-summary=list
Directory Options
-Idir -Jdir -fintrinsic-modules-path dir
Link Options
-static-libgfortran
Runtime Options
-fconvert=conversion -fmax-subrecord-length=length -frecord-marker=length -fsign-zero
Interoperability Options
-fc-prototypes
Code Generation Options
-faggressive-function-elimination -fblas-matmul-limit=n -fbounds-check -ftail-call-workaround -ftail-call-workaround=n -fcheck-array-temporaries -fcheck=<all|array-temps|bounds|do|mem|pointer|recursion> -fcoarray=<none|single|lib> -fexternal-blas -ff2c -ffrontend-loop-interchange -ffrontend-optimize -finit-character=n -finit-integer=n -finit-local-zero -finit-derived -finit-logical=<true|false> -finit-real=<zero|inf|-inf|nan|snan> -finline-matmul-limit=n -fmax-array-constructor=n -fmax-stack-var-size=n -fno-align-commons -fno-automatic -fno-protect-parens -fno-underscoring -fsecond-underscore -fpack-derived -frealloc-lhs -frecursive -frepack-arrays -fshort-enums -fstack-arrays

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=f95 to force standard-compliance but get access to the full range of intrinsics available with gfortran. As a consequence, -Wintrinsics-std will be ignored and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared "EXTERNAL".
-fd-lines-as-code
-fd-lines-as-comments
Enable special treatment for lines beginning with "d" or "D" in fixed form sources. If the -fd-lines-as-code option is given they are treated as if the first column contained a blank. If the -fd-lines-as-comments option is given, they are treated as comment lines.
-fdec
DEC compatibility mode. Enables extensions and other features that mimic the default behavior of older compilers (such as DEC). These features are non-standard and should be avoided at all costs. For details on GNU Fortran’s implementation of these extensions see the full documentation.

Other flags enabled by this switch are: -fdollar-ok -fcray-pointer -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math

If -fd-lines-as-code/-fd-lines-as-comments are unset, then -fdec also sets -fd-lines-as-comments.

-fdec-structure
Enable DEC "STRUCTURE" and "RECORD" as well as "UNION", "MAP", and dot (‘.’) as a member separator (in addition to ‘%’). This is provided for compatibility only; Fortran 90 derived types should be used instead where possible.
-fdec-intrinsic-ints
Enable B/I/J/K kind variants of existing integer functions (e.g. BIAND, IIAND, JIAND, etc…). For a complete list of intrinsics see the full documentation.
-fdec-math
Enable legacy math intrinsics such as COTAN and degree-valued trigonometric functions (e.g. TAND, ATAND, etc…) for compatability with older code.
-fdec-static
Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specify the storage of variables and other objects.
-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 $ in "IMPLICIT" statements 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 "", "", " ", " ", " ", " ", " ", "\", and "