OSDN Git Service

gcc/fortran/
[pf3gnuchains/gcc-fork.git] / gcc / fortran / invoke.texi
index 138951b..5385bba 100644 (file)
@@ -1,11 +1,11 @@
-@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
 @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
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -119,15 +119,15 @@ by type.  Explanations are in the following sections.
 -fdollar-ok  -fimplicit-none  -fmax-identifier-length @gol
 -std=@var{std}
 -ffixed-line-length-@var{n}  -ffixed-line-length-none @gol
 -fdollar-ok  -fimplicit-none  -fmax-identifier-length @gol
 -std=@var{std}
 -ffixed-line-length-@var{n}  -ffixed-line-length-none @gol
--i8  -r8  -d8}
+-fdefault-double-8  -fdefault-integer-8  -fdefault-real-8 }
 
 @item Warning Options
 @xref{Warning Options,,Options to Request or Suppress Warnings}.
 @gccoptlist{
 -fsyntax-only  -pedantic  -pedantic-errors @gol
 -w  -Wall  -Waliasing  -Wconversion @gol
 
 @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  -Wunderflow -Wunused-labels @gol
--Wline-truncation @gol
+-Wimplicit-interface  -Wnonstd-intrinsics  -Wsurprising  -Wunderflow @gol
+-Wunused-labels -Wline-truncation @gol
 -Werror  -W}
 
 @item Debugging Options
 -Werror  -W}
 
 @item Debugging Options
@@ -143,13 +143,11 @@ by type.  Explanations are in the following sections.
 @item Code Generation Options
 @xref{Code Gen Options,,Options for Code Generation Conventions}.
 @gccoptlist{
 @item Code Generation Options
 @xref{Code Gen Options,,Options for Code Generation Conventions}.
 @gccoptlist{
--fno-underscoring  -fno-second-underscore @gol
+-ff2c -fno-underscoring  -fsecond-underscore @gol
 -fbounds-check  -fmax-stack-var-size=@var{n} @gol
 -fpackderived  -frepack-arrays}
 @end table
 
 -fbounds-check  -fmax-stack-var-size=@var{n} @gol
 -fpackderived  -frepack-arrays}
 @end table
 
-@c man end
-
 @menu
 * Fortran Dialect Options::  Controlling the variant of Fortran language
                              compiled.
 @menu
 * Fortran Dialect Options::  Controlling the variant of Fortran language
                              compiled.
@@ -181,10 +179,27 @@ that the compiler accepts:
 @cindex Fortran 90, features
 @item -ffree-form
 @item -ffixed-form
 @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 the source file. The free form layout
 was introduced in Fortran 90.  Fixed form was traditionally used in
 older Fortran programs.
 
 was introduced in Fortran 90.  Fixed form was traditionally used in
 older Fortran programs.
 
+@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 -fdollar-ok option
 @cindex options, -fdollar-ok
 @item -fdollar-ok
@@ -233,20 +248,7 @@ Specify that no implicit typing is allowed, unless overridden by explicit
 @cindex option, -std=@var{std}
 @item -std=@var{std}
 Conform to the specified standard.  Allowed values for @var{std} are
 @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} and @samp{f95}.
 
 @end table
 
 
 @end table
 
@@ -319,19 +321,30 @@ Inhibit all warning messages.
 Enables commonly used warning options that which pertain to usage that
 we recommend avoiding and that we believe is easy to avoid.
 This currently includes @option{-Wunused-labels}, @option{-Waliasing},
 Enables commonly used warning options that which pertain to usage that
 we recommend avoiding and that we believe is easy to avoid.
 This currently includes @option{-Wunused-labels}, @option{-Waliasing},
-@option{-Wsurprising} and @option{-Wline-truncation}.
+@option{-Wsurprising}, @option{-Wnonstd-intrinsic} and
+@option{-Wline-truncation}.
 
 
 @cindex -Waliasing option
 @cindex options, -Waliasing
 @item -Waliasing
 @cindex aliasing
 
 
 @cindex -Waliasing option
 @cindex options, -Waliasing
 @item -Waliasing
 @cindex aliasing
-Warn about possible aliasing of dummy arguments. The following example
-will trigger the warning 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
 @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
 
 
 @end smallexample
 
 
@@ -350,6 +363,13 @@ Note this only checks that an explicit interface is present.  It does not
 check that the declared interfaces are consistent across program units.
 
 
 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 -Wsurprising
 @cindex options, -Wsurprising
 @item -Wsurprising
@@ -361,8 +381,8 @@ This currently produces a warning under the following circumstances:
 
 @itemize @bullet
 @item
 
 @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.
 
 @item
 A LOGICAL SELECT construct has three CASE statements.
@@ -498,8 +518,43 @@ it.
 
 
 @table @gcctabopt
 
 
 @table @gcctabopt
-@cindex -fno-underscoring option
-@cindex options, -fno-underscoring
+@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 @options{-fsecond-underscore}
+option, unless @options{-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
 @item -fno-underscoring
 @cindex underscore
 @cindex symbol names, underscores
@@ -508,16 +563,17 @@ it.
 Do not transform names of entities specified in the Fortran
 source file by appending underscores to them.
 
 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
 
 This is done to ensure compatibility with code produced by many
-UNIX Fortran compilers, including @command{f2c} which perform the
-same transformations.
+UNIX Fortran compilers.
+
+@emph{Caution}: The default behavior of @command{gfortran} is
+incompatible with @command{f2c} and @command{g77}, please use the
+@option{-ff2c} and @option{-fsecond-underscore} options 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
 
 Use of @option{-fno-underscoring} is not recommended unless you are
 experimenting with issues such as integration of (GNU) Fortran into
@@ -573,22 +629,31 @@ in the source, even if the names as seen by the linker are mangled to
 prevent accidental linking between procedures with incompatible
 interfaces.
 
 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
 @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
 
 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
 
 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
 
 
 @cindex -fbounds-check option