]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/f/invoke.texi
PR c++/17413
[thirdparty/gcc.git] / gcc / f / invoke.texi
index 4199af62c9a7e2bebd732fcee404fd05ddc69618..fd1b80412a64c8503976b3fe45f36a79ed3caad6 100644 (file)
@@ -1,15 +1,15 @@
-@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
 @c Free Software Foundation, Inc.
 @c This is part of the G77 manual.   
 @c For copying conditions, see the file g77.texi.
 
 @ignore
 @c man begin COPYRIGHT
-Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001
+Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
 any later version published by the Free Software Foundation; with the
 Invariant Sections being ``GNU General Public License'' and ``Funding
 Free Software'', the Front-Cover texts being (a) (see below), and with
@@ -53,8 +53,7 @@ For instructions on reporting bugs, see
 script to report bugs is recommended.
 @c man end
 @c man begin AUTHOR
-See the Info entry for @file{g77}, or
-@w{@uref{http://gcc.gnu.org/thanks.html}}, for contributors to GCC and G77@.
+See the Info entry for @command{g77} for contributors to GCC and G77@.
 @c man end
 @end ignore
 
@@ -68,8 +67,8 @@ See the Info entry for @file{g77}, or
 
 The @command{g77} command supports all the options supported by the
 @command{gcc} command.
-@xref{Invoking GCC,,GNU CC Command Options,gcc,Using and Porting GNU CC},
-for information
+@xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
+Collection (GCC)}, for information
 on the non-Fortran-specific aspects of the @command{gcc} command (and,
 therefore, the @command{g77} command).
 
@@ -133,43 +132,43 @@ by type.  Explanations are in the following sections.
 @item Fortran Language Options
 @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
 @gccoptlist{
--ffree-form  -fno-fixed-form  -ff90
--fvxt  -fdollar-ok  -fno-backslash
--fno-ugly-args  -fno-ugly-assign  -fno-ugly-assumed
--fugly-comma  -fugly-complex  -fugly-init  -fugly-logint
--fonetrip  -ftypeless-boz
--fintrin-case-initcap  -fintrin-case-upper
--fintrin-case-lower  -fintrin-case-any
--fmatch-case-initcap  -fmatch-case-upper
--fmatch-case-lower  -fmatch-case-any
--fsource-case-upper  -fsource-case-lower
--fsource-case-preserve
--fsymbol-case-initcap  -fsymbol-case-upper
--fsymbol-case-lower  -fsymbol-case-any
--fcase-strict-upper  -fcase-strict-lower
--fcase-initcap  -fcase-upper  -fcase-lower  -fcase-preserve
--ff2c-intrinsics-delete  -ff2c-intrinsics-hide
--ff2c-intrinsics-disable  -ff2c-intrinsics-enable
--fbadu77-intrinsics-delete  -fbadu77-intrinsics-hide
--fbadu77-intrinsics-disable  -fbadu77-intrinsics-enable
--ff90-intrinsics-delete  -ff90-intrinsics-hide
--ff90-intrinsics-disable  -ff90-intrinsics-enable
--fgnu-intrinsics-delete  -fgnu-intrinsics-hide
--fgnu-intrinsics-disable  -fgnu-intrinsics-enable
--fmil-intrinsics-delete  -fmil-intrinsics-hide
--fmil-intrinsics-disable  -fmil-intrinsics-enable
--funix-intrinsics-delete  -funix-intrinsics-hide
--funix-intrinsics-disable  -funix-intrinsics-enable
--fvxt-intrinsics-delete  -fvxt-intrinsics-hide
--fvxt-intrinsics-disable  -fvxt-intrinsics-enable
+-ffree-form  -fno-fixed-form  -ff90 @gol
+-fvxt  -fdollar-ok  -fno-backslash @gol
+-fno-ugly-args  -fno-ugly-assign  -fno-ugly-assumed @gol
+-fugly-comma  -fugly-complex  -fugly-init  -fugly-logint @gol
+-fonetrip  -ftypeless-boz @gol
+-fintrin-case-initcap  -fintrin-case-upper @gol
+-fintrin-case-lower  -fintrin-case-any @gol
+-fmatch-case-initcap  -fmatch-case-upper @gol
+-fmatch-case-lower  -fmatch-case-any @gol
+-fsource-case-upper  -fsource-case-lower @gol
+-fsource-case-preserve @gol
+-fsymbol-case-initcap  -fsymbol-case-upper @gol
+-fsymbol-case-lower  -fsymbol-case-any @gol
+-fcase-strict-upper  -fcase-strict-lower @gol
+-fcase-initcap  -fcase-upper  -fcase-lower  -fcase-preserve @gol
+-ff2c-intrinsics-delete  -ff2c-intrinsics-hide @gol
+-ff2c-intrinsics-disable  -ff2c-intrinsics-enable @gol
+-fbadu77-intrinsics-delete  -fbadu77-intrinsics-hide @gol
+-fbadu77-intrinsics-disable  -fbadu77-intrinsics-enable @gol
+-ff90-intrinsics-delete  -ff90-intrinsics-hide @gol
+-ff90-intrinsics-disable  -ff90-intrinsics-enable @gol
+-fgnu-intrinsics-delete  -fgnu-intrinsics-hide @gol
+-fgnu-intrinsics-disable  -fgnu-intrinsics-enable @gol
+-fmil-intrinsics-delete  -fmil-intrinsics-hide @gol
+-fmil-intrinsics-disable  -fmil-intrinsics-enable @gol
+-funix-intrinsics-delete  -funix-intrinsics-hide @gol
+-funix-intrinsics-disable  -funix-intrinsics-enable @gol
+-fvxt-intrinsics-delete  -fvxt-intrinsics-hide @gol
+-fvxt-intrinsics-disable  -fvxt-intrinsics-enable @gol
 -ffixed-line-length-@var{n}  -ffixed-line-length-none}
 
 @item Warning Options
 @xref{Warning Options,,Options to Request or Suppress Warnings}.
 @gccoptlist{
--fsyntax-only  -pedantic  -pedantic-errors  -fpedantic
--w  -Wno-globals  -Wimplicit  -Wunused  -Wuninitialized
--Wall  -Wsurprising
+-fsyntax-only  -pedantic  -pedantic-errors  -fpedantic @gol
+-w  -Wno-globals  -Wimplicit  -Wunused  -Wuninitialized @gol
+-Wall  -Wsurprising @gol
 -Werror  -W}
 
 @item Debugging Options
@@ -180,14 +179,14 @@ by type.  Explanations are in the following sections.
 @item Optimization Options
 @xref{Optimize Options,,Options that Control Optimization}.
 @gccoptlist{
--malign-double
--ffloat-store  -fforce-mem  -fforce-addr  -fno-inline
--ffast-math  -fstrength-reduce  -frerun-cse-after-loop
--funsafe-math-optimizations -fno-trapping-math
--fexpensive-optimizations  -fdelayed-branch
--fschedule-insns  -fschedule-insn2  -fcaller-saves
--funroll-loops  -funroll-all-loops
--fno-move-all-movables  -fno-reduce-all-givs
+-malign-double @gol
+-ffloat-store  -fforce-mem  -fforce-addr  -fno-inline @gol
+-ffast-math  -fstrength-reduce  -frerun-cse-after-loop @gol
+-funsafe-math-optimizations -ffinite-math-only -fno-trapping-math @gol
+-fexpensive-optimizations  -fdelayed-branch @gol
+-fschedule-insns  -fschedule-insn2  -fcaller-saves @gol
+-funroll-loops  -funroll-all-loops @gol
+-fno-move-all-movables  -fno-reduce-all-givs @gol
 -fno-rerun-loop-opt}
 
 @item Directory Options
@@ -198,15 +197,15 @@ by type.  Explanations are in the following sections.
 @item Code Generation Options
 @xref{Code Gen Options,,Options for Code Generation Conventions}.
 @gccoptlist{
--fno-automatic  -finit-local-zero  -fno-f2c
--ff2c-library  -fno-underscoring  -fno-ident
--fpcc-struct-return  -freg-struct-return
--fshort-double  -fno-common  -fpack-struct
--fzeros  -fno-second-underscore
--femulate-complex
--falias-check  -fargument-alias
--fargument-noalias  -fno-argument-noalias-global
--fno-globals  -fflatten-arrays
+-fno-automatic  -finit-local-zero  -fno-f2c @gol
+-ff2c-library  -fno-underscoring  -fno-ident @gol
+-fpcc-struct-return  -freg-struct-return @gol
+-fshort-double  -fno-common  -fpack-struct @gol
+-fzeros  -fno-second-underscore @gol
+-femulate-complex @gol
+-falias-check  -fargument-alias @gol
+-fargument-noalias  -fno-argument-noalias-global @gol
+-fno-globals  -fflatten-arrays @gol
 -fbounds-check  -ffortran-bounds-check}
 @end table
 
@@ -254,8 +253,9 @@ For any given input file, the file name suffix determines what kind of
 program is contained in the file---that is, the language in which the
 program is written is generally indicated by the suffix.
 Suffixes specific to GNU Fortran are listed below.
-@xref{Overall Options,,gcc,Using and Porting GNU CC}, for
-information on suffixes recognized by GNU CC.
+@xref{Overall Options,,Options Controlling the Kind of
+Output,gcc,Using the GNU Compiler Collection (GCC)}, for
+information on suffixes recognized by GCC.
 
 @table @gcctabopt
 @cindex .f filename suffix
@@ -286,7 +286,7 @@ You can force @samp{.f} files to be preprocessed by @command{cpp} by using
 @item @var{file}.fpp
 @item @var{file}.FPP
 Fortran source code that must be preprocessed (by the C preprocessor
-@command{cpp}, which is part of GNU CC).
+@command{cpp}, which is part of GCC).
 
 Note that preprocessing is not extended to the contents of
 files included by the @code{INCLUDE} directive---the @code{#include}
@@ -300,9 +300,7 @@ preprocessor directive must be used instead.
 Ratfor source code, which must be preprocessed by the @command{ratfor}
 command, which is available separately (as it is not yet part of the GNU
 Fortran distribution).
-One version in Fortran, adapted for use with @command{g77} is at
-@uref{ftp://members.aol.com/n8tm/rat7.uue} (of uncertain copyright
-status).  Another, public domain version in C is at
+A public domain version in C is at
 @uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}.
 @end table
 
@@ -350,7 +348,7 @@ line is a non-comment line of important code!
 @emph{Note:} The @option{-traditional} and @option{-undef} flags are supplied
 to @command{cpp} by default, to help avoid unpleasant surprises.
 @xref{Preprocessor Options,,Options Controlling the Preprocessor,
-gcc,Using and Porting GNU CC}.
+gcc,Using the GNU Compiler Collection (GCC)}.
 This means that ANSI C preprocessor features (such as the @samp{#}
 operator) aren't available, and only variables in the C reserved
 namespace (generally, names with a leading underscore) are liable to
@@ -389,7 +387,7 @@ This option is supplied automatically when @option{-v} or @option{--verbose}
 is specified as a command-line option for @command{g77} or @command{gcc}
 and when the resulting commands compile Fortran source files.
 
-In GCC 3.1, this is changed back to the behaviour @command{gcc} displays
+In GCC 3.1, this is changed back to the behavior @command{gcc} displays
 for @samp{.c} files.
 
 @cindex -fset-g77-defaults option
@@ -443,7 +441,7 @@ UNIX @command{f77} implementations and @command{f2c}
 @end table
 
 @xref{Overall Options,,Options Controlling the Kind of Output,
-gcc,Using and Porting GNU CC}, for information
+gcc,Using the GNU Compiler Collection (GCC)}, for information
 on more options that control the overall operation of the @command{gcc} command
 (and, by extension, the @command{g77} command).
 
@@ -1337,7 +1335,8 @@ for certain configurations).
 @end table
 
 @xref{Warning Options,,Options to Request or Suppress Warnings,
-gcc,Using and Porting GNU CC}, for information on more options offered
+gcc,Using the GNU Compiler Collection (GCC)}, for information on more
+options offered
 by the GBE shared by @command{g77} @command{gcc} and other GNU compilers.
 
 Some of these have no effect when compiling programs written in Fortran:
@@ -1355,6 +1354,12 @@ Some of these have no effect when compiling programs written in Fortran:
 @cindex -Wswitch option
 @cindex options, -Wswitch
 @item -Wswitch
+@cindex -Wswitch-default option
+@cindex options, -Wswitch-default
+@item -Wswitch-default
+@cindex -Wswitch-enum option
+@cindex options, -Wswitch-enum
+@item -Wswitch-enum
 @cindex -Wtraditional option
 @cindex options, -Wtraditional
 @item -Wtraditional
@@ -1397,10 +1402,42 @@ either your program or @command{g77}
 Produce debugging information in the operating system's native format
 (stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
 information.
+
+A sample debugging session looks like this (note the use of the breakpoint):
+@smallexample
+$ cat gdb.f
+      PROGRAM PROG
+      DIMENSION A(10)
+      DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./
+      A(5) = 4.
+      PRINT*,A
+      END
+$ g77 -g -O gdb.f
+$ gdb a.out
+...
+(gdb) break MAIN__ 
+Breakpoint 1 at 0x8048e96: file gdb.f, line 4.
+(gdb) run
+Starting program: /home/toon/g77-bugs/./a.out 
+Breakpoint 1, MAIN__ () at gdb.f:4
+4             A(5) = 4.
+Current language:  auto; currently fortran
+(gdb) print a(5)
+$1 = 5
+(gdb) step 
+5             PRINT*,A
+(gdb) print a(5)
+$2 = 4
+...
+@end smallexample
+One could also add the setting of the breakpoint and the first run command
+to the file @file{.gdbinit} in the current directory, to simplify the debugging
+session.
 @end table
 
-@xref{Debugging Options,,Options for Debugging Your Program or GNU CC,
-gcc,Using and Porting GNU CC}, for more information on debugging options.
+@xref{Debugging Options,,Options for Debugging Your Program or GCC,
+gcc,Using the GNU Compiler Collection (GCC)}, for more information on
+debugging options.
 
 @node Optimize Options
 @section Options That Control Optimization
@@ -1503,8 +1540,8 @@ Note that if you are not optimizing, no functions can be expanded inline.
 @cindex conformance, IEEE 754
 Might allow some programs designed to not be too dependent
 on IEEE behavior for floating-point to run faster, or die trying.
-Sets @option{-funsafe-math-optimizations}, and
-@option{-fno-trapping-math}.
+Sets @option{-funsafe-math-optimizations}, @option{-ffinite-math-only},
+and @option{-fno-trapping-math}.
 
 @cindex -funsafe-math-optimizations option
 @cindex options, -funsafe-math-optimizations
@@ -1512,6 +1549,18 @@ Sets @option{-funsafe-math-optimizations}, and
 Allow optimizations that may be give incorrect results
 for certain IEEE inputs.
 
+@cindex -ffinite-math-only option
+@cindex options, -ffinite-math-only
+@item -ffinite-math-only
+Allow optimizations for floating-point arithmetic that assume
+that arguments and results are not NaNs or +-Infs.
+
+This option should never be turned on by any @option{-O} option since
+it can result in incorrect output for programs which depend on
+an exact implementation of IEEE or ISO rules/specifications.
+
+The default is @option{-fno-finite-math-only}.
+
 @cindex -fno-trapping-math option
 @cindex options, -fno-trapping-math
 @item -fno-trapping-math
@@ -1605,30 +1654,25 @@ but possibly slower.
 @item -fno-rerun-loop-opt
 @cindex -fno-rerun-loop-opt option
 @cindex options, -fno-rerun-loop-opt
-@emph{Version info:}
-These options are not supported by
-versions of @command{g77} based on @command{gcc} version 2.8.
+In general, the optimizations enabled with these options will lead to
+faster code being generated by GNU Fortran; hence they are enabled by default
+when issuing the @command{g77} command.
 
-Each of these might improve performance on some code.
+@option{-fmove-all-movables} and @option{-freduce-all-givs} will enable
+loop optimization to move all loop-invariant index computations in nested
+loops over multi-rank array dummy arguments out of these loops.
 
-Analysis of Fortran code optimization and the resulting
-optimizations triggered by the above options were
-contributed by Toon Moene (@email{toon@@moene.indiv.nluug.nl}).
+@option{-frerun-loop-opt} will move offset calculations resulting
+from the fact that Fortran arrays by default have a lower bound of 1
+out of the loops.
 
 These three options are intended to be removed someday, once
-they have helped determine the efficacy of various
-approaches to improving the performance of Fortran code.
-
-Please let us know how use of these options affects
-the performance of your production code.
-We're particularly interested in code that runs faster
-when these options are @emph{disabled}, and in
-non-Fortran code that benefits when they are
-@emph{enabled} via the above @command{gcc} command-line options.
+loop optimization is sufficiently advanced to perform all those
+transformations without help from these options.
 @end table
 
 @xref{Optimize Options,,Options That Control Optimization,
-gcc,Using and Porting GNU CC}, for more information on options
+gcc,Using the GNU Compiler Collection (GCC)}, for more information on options
 to optimize the generated machine code.
 
 @node Preprocessor Options
@@ -1642,7 +1686,8 @@ These options control the C preprocessor, which is run on each C source
 file before actual compilation.
 
 @xref{Preprocessor Options,,Options Controlling the Preprocessor,
-gcc,Using and Porting GNU CC}, for information on C preprocessor options.
+gcc,Using the GNU Compiler Collection (GCC)}, for information on C
+preprocessor options.
 
 @cindex INCLUDE directive
 @cindex directive, INCLUDE
@@ -1710,7 +1755,8 @@ Also note that the general behavior of @option{-I} and
 looking for @file{header.gcc} files and other such things.
 
 @xref{Directory Options,,Options for Directory Search,
-gcc,Using and Porting GNU CC}, for information on the @option{-I} option.
+gcc,Using the GNU Compiler Collection (GCC)}, for information on the
+@option{-I} option.
 @end table
 
 @node Code Gen Options
@@ -2131,7 +2177,7 @@ to it users.)
 @end table
 
 @xref{Code Gen Options,,Options for Code Generation Conventions,
-gcc,Using and Porting GNU CC}, for information on more options
+gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
 offered by the GBE
 shared by @command{g77} @command{gcc} and other GNU compilers.
 
@@ -2180,8 +2226,8 @@ GNU Fortran currently does not make use of any environment
 variables to control its operation above and beyond those
 that affect the operation of @command{gcc}.
 
-@xref{Environment Variables,,Environment Variables Affecting GNU CC,
-gcc,Using and Porting GNU CC}, for information on environment
+@xref{Environment Variables,,Environment Variables Affecting GCC,
+gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
 variables.
 
 @c man end