OSDN Git Service

2009-05-08 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / invoke.texi
index b2370d4..c471521 100644 (file)
@@ -1,11 +1,11 @@
-@c Copyright (C) 2004, 2005, 2006, 2007, 2008
+@c Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
 @c Free Software Foundation, Inc.
 @c This is part of the GNU Fortran manual.   
 @c For copying conditions, see the file gfortran.texi.
 
 @ignore
 @c man begin COPYRIGHT
-Copyright @copyright{} 2004, 2005, 2006, 2007, 2008
+Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -138,7 +138,8 @@ and warnings}.
 -fsyntax-only  -pedantic  -pedantic-errors @gol
 -Wall  -Waliasing  -Wampersand  -Warray-bounds -Wcharacter-truncation @gol
 -Wconversion -Wimplicit-interface  -Wline-truncation  -Wintrinsics-std @gol
--Wsurprising -Wno-tabs  -Wunderflow -Wunused-parameter -Wintrinsics-shadow}
+-Wsurprising -Wno-tabs  -Wunderflow -Wunused-parameter -Wintrinsics-shadow @gol
+-Wno-align-commons}
 
 @item Debugging Options
 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
@@ -147,7 +148,8 @@ and warnings}.
 
 @item Directory Options
 @xref{Directory Options,,Options for directory search}.
-@gccoptlist{-I@var{dir}  -J@var{dir}  -M@var{dir}  -fintrinsic-modules-path @var{dir}}
+@gccoptlist{-I@var{dir}  -J@var{dir}  -M@var{dir}  @gol
+-fintrinsic-modules-path @var{dir}}
 
 @item Link Options
 @xref{Link Options,,Options for influencing the linking step}.
@@ -161,13 +163,15 @@ and warnings}.
 
 @item Code Generation Options
 @xref{Code Gen Options,,Options for code generation conventions}.
-@gccoptlist{-fno-automatic  -ff2c  -fno-underscoring
--fsecond-underscore @gol
--fbounds-check -fcheck-array-temporaries  -fmax-stack-var-size=@var{n} @gol
+@gccoptlist{-fno-automatic  -ff2c  -fno-underscoring @gol
+-fwhole-file -fsecond-underscore @gol
+-fbounds-check -fcheck-array-temporaries  -fmax-array-constructor =@var{n} @gol
+-fcheck=@var{<all|array-temps|bounds|do|recursion>}
+-fmax-stack-var-size=@var{n} @gol
 -fpack-derived  -frepack-arrays  -fshort-enums  -fexternal-blas @gol
 -fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
--finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan>} @gol
--finit-logical=@var{<true|false>} -finit-character=@var{n}}
+-finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol
+-finit-logical=@var{<true|false>} -finit-character=@var{n} -fno-align-commons}
 @end table
 
 @menu
@@ -207,12 +211,12 @@ form is determined by the file extension.
 
 @item -fall-intrinsics
 @opindex @code{fall-intrinsics}
-Accept all of the intrinsic procedures provided in libgfortran 
-without regard to the setting of @option{-std}.  In particular, 
-this option can be quite useful with @option{-std=f95}.  Additionally,
-@command{gfortran} will ignore @option{-Wintrinsics-std} and will never try
-to link to an @code{EXTERNAL} version if the intrinsic is not included in the
-selected standard.
+This option causes all intrinsic procedures (including the GNU-specific
+extensions) to be accepted.  This can be useful with @option{-std=f95} to
+force standard-compliance but get access to the full range of intrinsics
+available with @command{gfortran}.  As a consequence, @option{-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 @code{EXTERNAL}.
 
 @item -fd-lines-as-code
 @item -fd-lines-as-comments
@@ -226,24 +230,36 @@ comment lines.
 
 @item -fdefault-double-8
 @opindex @code{fdefault-double-8}
-Set the @code{DOUBLE PRECISION} type to an 8 byte wide type.
+Set the @code{DOUBLE PRECISION} type to an 8 byte wide type.  If
+@option{-fdefault-real-8} is given, @code{DOUBLE PRECISION} would
+instead be promoted to 16 bytes if possible, and @option{-fdefault-double-8}
+can be used to prevent this.  The kind of real constants like @code{1.d0} will
+not be changed by @option{-fdefault-real-8} though, so also
+@option{-fdefault-double-8} does not affect it.
 
 @item -fdefault-integer-8
 @opindex @code{fdefault-integer-8}
 Set the default integer and logical types to an 8 byte wide type.
-Do nothing if this is already the default.
+Do nothing if this is already the default.  This option also affects
+the kind of integer constants like @code{42}.
 
 @item -fdefault-real-8
 @opindex @code{fdefault-real-8}
 Set the default real type to an 8 byte wide type.
-Do nothing if this is already the default.
+Do nothing if this is already the default.  This option also affects
+the kind of non-double real constants like @code{1.0}, and does promote
+the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless
+@code{-fdefault-double-8} is given, too.
 
 @item -fdollar-ok
 @opindex @code{fdollar-ok}
 @cindex $
 @cindex symbol names
 @cindex character set
-Allow @samp{$} as a valid character in a symbol name.
+Allow @samp{$} as a valid non-first character in a symbol name. Symbols 
+that start with @samp{$} are rejected since it is unclear which rules to
+apply to implicit typing as different vendors implement different rules.
+Using @samp{$} in @code{IMPLICIT} statements is also rejected.
 
 @item -fbackslash
 @opindex @code{backslash}
@@ -443,6 +459,15 @@ but this can be inhibited with the negated form
 in the command line, this option has no effect, since no @code{#line}
 directives are emitted whatsoever.
 
+@item -idirafter @var{dir}
+@opindex @code{idirafter @var{dir}}
+@cindex preprocessing, include path
+Search @var{dir} for include files, but do it after all directories
+specified with @option{-I} and the standard system directories have
+been exhausted. @var{dir} is treated as a system include directory.
+If dir begins with @code{=}, then the @code{=} will be replaced by
+the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
+
 @item -imultilib @var{dir}
 @opindex @code{imultilib @var{dir}}
 @cindex preprocessing, include path
@@ -757,6 +782,10 @@ A LOGICAL SELECT construct has three CASE statements.
 
 @item
 A TRANSFER specifies a source that is shorter than the destination.
+
+@item
+The type of a function result is declared more than once with the same type.  If
+@option{-pedantic} or standard-conforming mode is enabled, this is an error.
 @end itemize
 
 @item -Wtabs
@@ -796,6 +825,14 @@ about unused dummy arguments, but about unused @code{PARAMETER} values.
 @option{-Wunused-parameter} is not included in @option{-Wall} but is
 implied by @option{-Wall -Wextra}.
 
+@item -Walign-commons
+@opindex @code{Walign-commons}
+@cindex warnings, alignment of COMMON blocks
+@cindex alignment of COMMON blocks
+By default, @command{gfortran} warns about any occasion of variables being
+padded for proper alignment inside a COMMON block. This warning can be turned
+off via @option{-Wno-align-commons}. See also @option{-falign-commons}.
+
 @item -Werror
 @opindex @code{Werror}
 @cindex warnings, to errors
@@ -837,7 +874,7 @@ zero), @samp{overflow} (overflow in a floating point operation),
 (operation produced a denormal value).
 
 Some of the routines in the Fortran runtime library, like
-@samp{CPU_TIME}, are likely to to trigger floating point exceptions when
+@samp{CPU_TIME}, are likely to trigger floating point exceptions when
 @code{ffpe-trap=precision} is used. For this reason, the use of 
 @code{ffpe-trap=precision} is not recommended.
 
@@ -962,7 +999,7 @@ variable override the default specified by @option{-fconvert}.}
 
 
 @item -fno-range-check
-@opindex @code{-fno-range-check}
+@opindex @code{fno-range-check}
 Disable range checking of input values during integer @code{READ} operations.
 For example, GNU Fortran will give an error if an input value is
 outside of the relevant range of [@code{-HUGE()}:@code{HUGE()}]. In other words,
@@ -1124,6 +1161,19 @@ in the source, even if the names as seen by the linker are mangled to
 prevent accidental linking between procedures with incompatible
 interfaces.
 
+@item -fwhole-file
+@opindex @code{fwhole-file}
+By default, GNU Fortran parses, resolves and translates each procedure
+in a file separately.  Using this option modifies this such that the
+whole file is parsed and placed in a single front-end tree.  During
+resolution, in addition to all the usual checks and fixups, references
+to external procedures that are in the same file effect resolution of
+that procedure, if not already done, and a check of the interfaces. The
+dependences are resolved by changing the order in which the file is
+translated into the backend tree.  Thus, a procedure that is referenced
+is translated before the reference and the duplication of backend tree
+declarations eliminated.
+
 @item -fsecond-underscore
 @opindex @code{fsecond-underscore}
 @cindex underscore
@@ -1149,33 +1199,83 @@ is implemented as a reference to the link-time external symbol
 for compatibility with @command{g77} and @command{f2c}, and is implied
 by use of the @option{-ff2c} option.
 
-@item -fbounds-check
-@opindex @code{fbounds-check}
+@item -fcheck=@var{<keyword>}
+@opindex @code{fcheck}
 @cindex array, bounds checking
 @cindex bounds checking
 @cindex range checking
 @cindex subscript checking
 @cindex checking subscripts
+@cindex run-time checking
+@cindex checking array temporaries
+
+Enable the generation of run-time checks; the argument shall be
+a comma-delimited list of the following keywords.
+
+@table @asis
+@item @samp{all}
+Enable all run-time test of @option{-fcheck}.
+
+@item @samp{array-temps}
+Warns at run time when for passing an actual argument a temporary array
+had to be generated. The information generated by this warning is
+sometimes useful in optimization, in order to avoid such temporaries.
+
+Note: The warning is only printed once per location.
+
+@item @samp{bounds}
 Enable generation of run-time checks for array subscripts
 and against the declared minimum and maximum values.  It also
 checks array indices for assumed and deferred
-shape arrays against the actual allocated bounds.
+shape arrays against the actual allocated bounds and ensures that all string
+lengths are equal for character array constructors without an explicit
+typespec.
 
-Some checks require that @option{-fbounds-check} is set for
+Some checks require that @option{-fcheck=bounds} is set for
 the compilation of the main program.
 
-In the future this may also include other forms of checking, e.g., checking
-substring references.
+Note: In the future this may also include other forms of checking, e.g.,
+checking substring references.
+
+@item @samp{do}
+Enable generation of run-time checks for invalid modification of loop
+iteration variables.
 
+@item @samp{recursion}
+Enable generation of run-time checks for recursively called subroutines and
+functions which are not marked as recursive. See also @option{-frecursive}.
+@end table
 
-@item fcheck-array-temporaries
+
+@item -fbounds-check
+@opindex @code{fbounds-check}
+@c Note: This option is also referred in gcc's manpage
+Deprecated alias for @option{-fcheck=bounds}.
+
+@item -fcheck-array-temporaries
 @opindex @code{fcheck-array-temporaries}
-@cindex checking array temporaries
-Warns at run time when for passing an actual argument a temporary array
-had to be generated. The information generated by this warning is
-sometimes useful in optimization, in order to avoid such temporaries.
+Deprecated alias for @option{-fcheck=array-temps}.
 
-Note: The warning is only printed once per location.
+@item -fmax-array-constructor=@var{n}
+@opindex @code{fmax-array-constructor}
+This option can be used to increase the upper limit permitted in 
+array constructors.  The code below requires this option to expand
+the array at compile time.
+
+@smallexample
+@code{program test}
+@code{implicit none}
+@code{integer j}
+@code{integer, parameter :: n = 100000}
+@code{integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)}
+@code{print '(10(I0,1X))', i}
+@code{end program test}
+@end smallexample
+
+@emph{Caution:  This option can lead to long compile times and excessively
+large object files.}
+
+The default value for @var{n} is 65535.
 
 
 @item -fmax-stack-var-size=@var{n}
@@ -1246,7 +1346,7 @@ on the stack. This flag cannot be used together with
 
 @item -finit-local-zero
 @item -finit-integer=@var{n}
-@item -finit-real=@var{<zero|inf|-inf|nan>} 
+@item -finit-real=@var{<zero|inf|-inf|nan|snan>} 
 @item -finit-logical=@var{<true|false>}
 @item -finit-character=@var{n}
 @opindex @code{finit-local-zero}
@@ -1260,7 +1360,7 @@ variables to zero, @code{LOGICAL} variables to false, and
 @code{CHARACTER} variables to a string of null bytes.  Finer-grained
 initialization options are provided by the
 @option{-finit-integer=@var{n}},
-@option{-finit-real=@var{<zero|inf|-inf|nan>}} (which also initializes
+@option{-finit-real=@var{<zero|inf|-inf|nan|snan>}} (which also initializes
 the real and imaginary parts of local @code{COMPLEX} variables),
 @option{-finit-logical=@var{<true|false>}}, and
 @option{-finit-character=@var{n}} (where @var{n} is an ASCII character
@@ -1270,7 +1370,22 @@ type variables, nor do they initialize variables that appear in an
 future releases).
 
 Note that the @option{-finit-real=nan} option initializes @code{REAL}
-and @code{COMPLEX} variables with a quiet NaN.
+and @code{COMPLEX} variables with a quiet NaN. For a signalling NaN
+use @option{-finit-real=snan}; note, however, that compile-time
+optimizations may convert them into quiet NaN and that trapping
+needs to be enabled (e.g. via @option{-ffpe-trap}).
+
+@item -falign-commons
+@opindex @code{falign-commons}
+@cindex alignment of COMMON blocks
+By default, @command{gfortran} enforces proper alignment of all variables in a
+COMMON block by padding them as needed. On certain platforms this is mandatory,
+on others it increases performance. If a COMMON block is not declared with
+consistent data types everywhere, this padding can cause trouble, and
+@option{-fno-align-commons } can be used to disable automatic alignment. The
+same form of this option should be used for all files that share a COMMON block.
+To avoid potential alignment issues in COMMON blocks, it is recommended to order
+objects from largests to smallest.
 @end table
 
 @xref{Code Gen Options,,Options for Code Generation Conventions,