GFORTRAN(1) GNU GFORTRAN(1)
gfortran - GNU Fortran compiler
[-g] [-pg] [-Olevel]
[-o outfile] infile...
Only the most useful options are listed here; see below for the remainder.
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.
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 -ffree-form -fno-fixed-form -fdollar-ok -fimplicit-none -fmax-identifier-length -std=std -fd-lines-as-code
-fd-lines-as-comments -ffixed-line-length-n -ffixed-line-length-none -ffree-line-length-n -ffree-line-length-none -fdefault-double-8
-fdefault-integer-8 -fdefault-real-8 -fcray-pointer -fopenmp -fno-range-check -fbackslash -fmodule-private
-cpp -dD -dI -dM -dN -dU -fworking-directory -imultilib dir -iprefix file -isysroot dir -iquote -isystem dir -nocpp -nostdinc -undef
-Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -Umacro -H -P
Error and Warning Options
-fmax-errors=n -fsyntax-only -pedantic -pedantic-errors -Wall -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation
-Wconversion -Wimplicit-interface -Wline-truncation -Wintrinsics-std -Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter
-fdump-parse-tree -ffpe-trap=list -fdump-core -fbacktrace
-Idir -Jdir -fintrinsic-modules-path dir
-fconvert=conversion -fno-range-check -frecord-marker=length -fmax-subrecord-length=length -fsign-zero
Code Generation Options
-fno-automatic -ff2c -fno-underscoring -fsecond-underscore -fbounds-check -fcheck-array-temporaries -fmax-array-constructor =n
-fmax-stack-var-size=n -fpack-derived -frepack-arrays -fshort-enums -fexternal-blas -fblas-matmul-limit=n -frecursive
-finit-local-zero -finit-integer=n -finit-real=<zero|inf|-inf|nan> -finit-logical=<true|false> -finit-character=n -fno-align-commons
Options controlling Fortran dialect
The following options control the details of the Fortran dialect accepted by the compiler:
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.
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".
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.
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.
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.
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.
Allow $ as a valid character in a symbol name.
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 "