GFORTRAN(1) GNU GFORTRAN(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 -fdefault-double-8 -fdefault-integer-8
-fdefault-real-8 -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 -fno-fixed-form -fno-range-check -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
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 -Warray-bounds -Wc-binding-type -Wcharacter-truncation -Wconversion -Wfunction-elimination
-Wimplicit-interface -Wimplicit-procedure -Wintrinsic-shadow -Wintrinsics-std -Wline-truncation -Wno-align-commons -Wno-tabs
-Wreal-q-constant -Wsurprising -Wunderflow -Wunused-parameter -Wrealloc-lhs Wrealloc-lhs-all -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
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
Code Generation Options
-faggressive-function-elimination -fblas-matmul-limit=n -fbounds-check -fcheck-array-temporaries
-fcheck=<all|array-temps|bounds|do|mem|pointer|recursion> -fcoarray=<none|single|lib> -fexternal-blas -ff2c -ffrontend-optimize
-finit-character=n -finit-integer=n -finit-local-zero -finit-logical=<true|false> -finit-real=<zero|inf|-inf|nan|snan>
-fmax-array-constructor=n -fmax-stack-var-size=n -fno-align-commons -fno-automatic -fno-protect-parens -fno-underscoring
-fno-whole-file -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.
-fdefault-double-8
Set the "DOUBLE PRECISION" type to an 8 byte wide type. 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.
-fdefault-integer-8
Set the default integer and logical types to an 8 byte wide type. Do nothing if this is already the default. This option also affects
the kind of integer constants like 42.
-fdefault-real-8
Set the default real type to an 8 byte wide type. Do nothing if this is already the default. This option also affects the kind of
non-double real constants like 1.0, and does promote the default width of "DOUBLE PRECISION" to 16 bytes if possible, unless
"-fdefault-double-8" is given, too.
-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 "a", "", "f", "
", "
", " ", "v", "\", and "