-@c Copyright (C) 2004
+@c Copyright (C) 2004, 2005
@c Free Software Foundation, Inc.
@c This is part of the GFORTRAN manual.
@c For copying conditions, see the file gfortran.texi.
@ignore
@c man begin COPYRIGHT
-Copyright @copyright{} 2004
+Copyright @copyright{} 2004, 2005
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
@gccoptlist{
-ffree-form -fno-fixed-form @gol
-fdollar-ok -fimplicit-none -fmax-identifier-length @gol
--std=@var{std}
+-std=@var{std} -fd-lines-as-code -fd-lines-as-comments @gol
-ffixed-line-length-@var{n} -ffixed-line-length-none @gol
--i8 -r8 -d8}
+-fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol
+-fcray-pointer }
@item Warning Options
@xref{Warning Options,,Options to Request or Suppress Warnings}.
@gccoptlist{
-fsyntax-only -pedantic -pedantic-errors @gol
-w -Wall -Waliasing -Wconversion @gol
--Wimplicit-interface -Wsurprising -Wunused-labels @gol
--Wline-truncation @gol
--Werror -W}
+-Wimplicit-interface -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
+-Wunused-labels -Wline-truncation -W}
@item Debugging Options
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
@gccoptlist{
--fdump-parse-tree}
+-fdump-parse-tree -ffpe-trap=@var{list}}
@item Directory Options
@xref{Directory Options,,Options for Directory Search}.
@item Code Generation Options
@xref{Code Gen Options,,Options for Code Generation Conventions}.
@gccoptlist{
--fno-underscoring -fno-second-underscore @gol
+-fno-automatic -ff2c -fno-underscoring -fsecond-underscore @gol
-fbounds-check -fmax-stack-var-size=@var{n} @gol
--fpackderived -frepack-arrays}
+-fpackderived -frepack-arrays -fshort-enums}
@end table
-@c man end
-
@menu
* Fortran Dialect Options:: Controlling the variant of Fortran language
compiled.
@cindex Fortran 90, features
@item -ffree-form
@item -ffixed-form
-Specify the layout used by the the source file. The tree form layout
+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.
+@cindex option, -fd-lines-as-code
+@cindex -fd-lines-as-code, option
+@cindex option, -fd-lines-as-comments
+@cindex -fd-lines-as-comments, option
+@item -fd-lines-as-code
+@item -fd-lines-as-comment
+Enables special treating for lines with @samp{d} or @samp{D} in fixed
+form sources. If the @option{-fd-lines-as-code} option is given
+they are treated as if the first column contained a blank. If the
+@option{-fd-lines-as-comments} option is given, they are treated as
+comment lines.
+
+@cindex option, -fdefault-double-8
+@cindex -fdefault-double-8, option
+@item -fdefault-double-8
+Set the "DOUBLE PRECISION" type to an 8 byte wide.
+
+@cindex option, -fdefault-integer-8
+@cindex -fdefault-integer-8, option
+@item -fdefault-integer-8
+Set the default integer and logical types to an 8 byte wide type.
+Do nothing if this is already the default.
+
+@cindex option, -fdefault-real-8
+@cindex -fdefault-real-8, option
+@item -fdefault-real-8
+Set the default real type to an 8 byte wide type.
+Do nothing if this is already the default.
+
@cindex -fdollar-ok option
@cindex options, -fdollar-ok
@item -fdollar-ok
@cindex character set
Allow @samp{$} as a valid character in a symbol name.
+@cindex -fno-backslash option
+@cindex options, -fno-backslash
+@item -fno-backslash
+@cindex backslash
+@cindex escape characters
+@item
+Compile switch to change the interpretation of a backslash from
+``C''-style escape characters to a single backslash character.
+
@cindex -ffixed-line-length-@var{n} option
@cindex options, -ffixed-line-length-@var{n}
@item -ffixed-line-length-@var{n}
Specify the maximum allowed identifier length. Typical values are
31 (Fortran 95) and 63 (Fortran 200x).
-@cindex -fimpicit-none option
+@cindex -fimplicit-none option
@cindex options, -fimplicit-none
@item -fimplicit-none
Specify that no implicit typing is allowed, unless overridden by explicit
@samp{IMPLICIT} statements. This is the equivalent of adding
@samp{implicit none} to the start of every procedure.
+@cindex -fcray-pointer option
+@cindex options, -fcray-pointer
+@item -fcray-pointer
+Enables the Cray pointer extension, which provides a C-like pointer.
+
@cindex -std=@var{std} option
@cindex option, -std=@var{std}
@item -std=@var{std}
Conform to the specified standard. Allowed values for @var{std} are
-@samp{gnu}, @samp{f95} and @samp{f90}.
-
-@cindex option, -i8
-@cindex -i8, option
-@cindex option, -r8
-@cindex -r8, option
-@cindex option, -d8
-@cindex -d8, option
-@item -i8
-@item -r8
-@item -d8
-The @option{-i8} and @option{-j8} options set the default INTEGER and REAL
-kinds to KIND=8. The @option{-d8} option is equivalent to specifying
-both @option{-i8} and @option{-r8}.
+@samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
@end table
@cindex warnings, all
Enables commonly used warning options that which pertain to usage that
we recommend avoiding and that we believe is easy to avoid.
-This currenly includes @option{-Wunused-labels}, @option{-Waliasing},
-@option{-Wsurprising} and @option{-Wline-truncation}.
+This currently includes @option{-Wunused-labels}, @option{-Waliasing},
+@option{-Wsurprising}, @option{-Wnonstd-intrinsic} and
+@option{-Wline-truncation}.
@cindex -Waliasing option
@cindex options, -Waliasing
@item -Waliasing
@cindex aliasing
-Warn about possible aliasing of dummy arguments. The following example
-witll trigger teh warhing as it would be illegal to @code{bar} to
-modify either parameter.
+Warn about possible aliasing of dummy arguments. Specifically, it warns
+if the same actual argument is associated with a dummy argument with
+@code{intent(in)} and a dummy argument with @code{intent(out)} in a call
+with an explicit interface.
+
+The following example will trigger the warning.
@smallexample
- INTEGER A
- CALL BAR(A,A)
+ interface
+ subroutine bar(a,b)
+ integer, intent(in) :: a
+ integer, intent(out) :: b
+ end subroutine
+ end interface
+ integer :: a
+
+ call bar(a,a)
@end smallexample
check that the declared interfaces are consistent across program units.
+@cindex -Wnonstd-intrinsic option
+@cindex options, -Wnonstd-intrinsic
+@item -Wnonstd-intrinsic
+Warn if the user tries to use an intrinsic that does not belong to the
+standard the user has chosen via the -std option.
+
+
@cindex -Wsurprising
@cindex options, -Wsurprising
@item -Wsurprising
@cindex Suspicious
-Produce a warning when ``suspicous'' code constructs are encountered.
-While techically legal these usually indicate that an error has been made.
+Produce a warning when ``suspicious'' code constructs are encountered.
+While technically legal these usually indicate that an error has been made.
This currently produces a warning under the following circumstances:
@itemize @bullet
@item
-An INTEGER SELECT construct has a CASE the can never be matched as it's
-lower value that is greater than its upper value.
+An INTEGER SELECT construct has a CASE that can never be matched as its
+lower value is greater than its upper value.
@item
A LOGICAL SELECT construct has three CASE statements.
@end itemize
+@cindex -Wunderflow
+@cindex options, -Wunderflow
+@item -Wunderflow
+@cindex UNDERFLOW
+Produce a warning when numerical constant expressions are
+encountered, which yield an UNDERFLOW during compilation.
+
+
@cindex -Wunused-labels option
@cindex options, -Wunused-labels
@item -Wunused-labels
@cindex option, -fdump-parse-tree
@item -fdump-parse-tree
Output the internal parse tree before starting code generation. Only
-really usedful for debugging gfortran itself.
+really useful for debugging gfortran itself.
+@end table
+
+@table @gcctabopt
+@cindex -ffpe-trap=@var{list} option
+@cindex option, -ffpe-trap=@var{list}
+@item -ffpe-trap=@var{list}
+Specify a list of IEEE exceptions when a Floating Point Exception
+(FPE) should be raised. On most systems, this will result in a SIGFPE
+signal being sent and the program being interrupted, producing a core
+file useful for debugging. @var{list} is a (possibly empty) comma-separated
+list of the following IEEE exceptions: @samp{invalid} (invalid floating
+point operation, such as @code{sqrt(-1.0)}), @samp{zero} (division by
+zero), @samp{overflow} (overflow in a floating point operation),
+@samp{underflow} (underflow in a floating point operation),
+@samp{precision} (loss of precision during operation) and @samp{denormal}
+(operation produced a denormal denormal value).
@end table
@xref{Debugging Options,,Options for Debugging Your Program or GCC,
@cindex INCLUDE directive
@cindex directive, INCLUDE
-There options affect how affect how @command{gfortran} searches
-for files specified via the @code{INCLUDE} directive, and where it searches
+These options affect how @command{gfortran} searches
+for files specified by the @code{INCLUDE} directive and where it searches
for previously compiled modules.
It also affects the search paths used by @command{cpp} when used to preprocess
-fortran source.
+Fortran source.
@table @gcctabopt
@cindex -Idir option
@cindex option, -Mdir
@item -M@var{dir}
@item -J@var{dir}
-This option specifies where to put @samp{.mod} files for compiled modiles.
-It is also added to the list of directories to searhed by an @code{USE}
+This option specifies where to put @samp{.mod} files for compiled modules.
+It is also added to the list of directories to searched by an @code{USE}
statement.
The default is the current directory.
can figure out the other form by either removing @option{no-} or adding
it.
-
@table @gcctabopt
-@cindex -fno-underscoring option
-@cindex options, -fno-underscoring
+@cindex @option{-fno-automatic} option
+@cindex options, @option{-fno-automatic}
+@item -fno-automatic
+@cindex SAVE statement
+@cindex statements, SAVE
+Treat each program unit as if the @code{SAVE} statement was specified for
+every local variable and array referenced in it. Does not affect common
+blocks. (Some Fortran compilers provide this option under the name
+@option{-static}.)
+
+@cindex @option{-ff2c} option
+@cindex options, @option{-ff2c}
+@item -ff2c
+@cindex calling convention
+@cindex @command{f2c} calling convention
+@cindex @command{g77} calling convention
+@cindex libf2c calling convention
+Generate code designed to be compatible with code generated
+by @command{g77} and @command{f2c}.
+
+The calling conventions used by @command{g77} (originally implemented
+in @command{f2c}) require functions that return type
+default @code{REAL} to actually return the C type @code{double}, and
+functions that return type @code{COMPLEX} to return the values via an
+extra argument in the calling sequence that points to where to
+store the return value. Under the default GNU calling conventions, such
+functions simply return their results as they would in GNU
+C -- default @code{REAL} functions return the C type @code{float}, and
+@code{COMPLEX} functions return the GNU C type @code{complex}.
+Additionally, this option implies the @option{-fsecond-underscore}
+option, unless @option{-fno-second-underscore} is explicitly requested.
+
+This does not affect the generation of code that interfaces with
+the @command{libgfortran} library.
+
+@emph{Caution:} It is not a good idea to mix Fortran code compiled
+with @code{-ff2c} with code compiled with the default @code{-fno-f2c}
+calling conventions as, calling @code{COMPLEX} or default @code{REAL}
+functions between program parts which were compiled with different
+calling conventions will break at execution time.
+
+@emph{Caution:} This will break code which passes intrinsic functions
+of type default @code{REAL} or @code{COMPLEX} as actual arguments, as
+the library implementations use the @command{-fno-f2c} calling conventions.
+
+@cindex @option{-fno-underscoring option}
+@cindex options, @option{-fno-underscoring}
@item -fno-underscoring
@cindex underscore
@cindex symbol names, underscores
Do not transform names of entities specified in the Fortran
source file by appending underscores to them.
-With @option{-funderscoring} in effect, @command{gfortran} appends two
-underscores to names with underscores and one underscore to external names
-with no underscores. (@command{gfortran} also appends two underscores to
-internal names with underscores to avoid naming collisions with external
-names. The @option{-fno-second-underscore} option disables appending of the
-second underscore in all cases.)
+With @option{-funderscoring} in effect, @command{gfortran} appends one
+underscore to external names with no underscores. This is done to ensure
+compatibility with code produced by many UNIX Fortran compilers.
-This is done to ensure compatibility with code produced by many
-UNIX Fortran compilers, including @command{f2c} which perform the
-same transformations.
+@emph{Caution}: The default behavior of @command{gfortran} is
+incompatible with @command{f2c} and @command{g77}, please use the
+@option{-ff2c} option if you want object files compiled with
+@option{gfortran} to be compatible with object code created with these
+tools.
Use of @option{-fno-underscoring} is not recommended unless you are
experimenting with issues such as integration of (GNU) Fortran into
prevent accidental linking between procedures with incompatible
interfaces.
-@cindex -fno-second-underscore option
-@cindex options, -fno-second-underscore
-@item -fno-second-underscore
+@cindex @option{-fsecond-underscore option}
+@cindex options, @option{-fsecond-underscore}
+@item -fsecond-underscore
@cindex underscore
@cindex symbol names, underscores
@cindex transforming symbol names
@cindex symbol names, transforming
-Do not append a second underscore to names of entities specified
-in the Fortran source file.
+@cindex @command{f2c} calling convention
+@cindex @command{g77} calling convention
+@cindex libf2c calling convention
+By default, @command{gfortran} appends an underscore to external
+names. If this option is used @command{gfortran} appends two
+underscores to names with underscores and one underscore to external names
+with no underscores. (@command{gfortran} also appends two underscores to
+internal names with underscores to avoid naming collisions with external
+names.
This option has no effect if @option{-fno-underscoring} is
-in effect.
+in effect. It is implied by the @option{-ff2c} option.
Otherwise, with this option, an external name such as @samp{MAX_COUNT}
is implemented as a reference to the link-time external symbol
-@samp{max_count_}, instead of @samp{max_count__}.
+@samp{max_count__}, instead of @samp{max_count_}. This is required
+for compatibility with @command{g77} and @command{f2c}, and is implied
+by use of the @option{-ff2c} option.
@cindex -fbounds-check option
checks array indices for assumed and deferred
shape arrays against the actual allocated bounds.
-In the future this may also include other forms of checking, eg. checing
+In the future this may also include other forms of checking, eg. checking
substring references.
@item -fpackderived
@cindex Structure packing
This option tells gfortran to pack derived type members as closely as
-possible. Code compiled with this option is likley to be incompatible
+possible. Code compiled with this option is likely to be incompatible
with code compiled without this option, and may execute slower.
@cindex -frepack-arrays option
This should result in faster accesses to the array. However it can introduce
significant overhead to the function call, especially when the passed data
is discontiguous.
+
+@cindex -fshort-enums
+@item -fshort-enums
+This option is provided for interoperability with C code that was
+compiled with the @command{-fshort-enums} option. It will make
+@command{gfortran} choose the smallest @code{INTEGER} kind a given
+enumerator set will fit in, and give all its enumerators this kind.
@end table
@xref{Code Gen Options,,Options for Code Generation Conventions,