diff options
author | Toon Moene <toon@moene.indiv.nluug.nl> | 2001-11-04 22:53:41 +0100 |
---|---|---|
committer | Toon Moene <toon@gcc.gnu.org> | 2001-11-04 21:53:41 +0000 |
commit | 966c049dbf5e87774306aafddd0295a21657a1da (patch) | |
tree | 9d3b6a456d5f141a6e918d607fe71762a8872d4b | |
parent | e9b2c82318e18123d95a35e91b9c27806c0867d2 (diff) | |
download | gcc-966c049dbf5e87774306aafddd0295a21657a1da.zip gcc-966c049dbf5e87774306aafddd0295a21657a1da.tar.gz gcc-966c049dbf5e87774306aafddd0295a21657a1da.tar.bz2 |
g77.texi: Split off invoke.texi (preliminary to using it to generate a man page).
2001-11-04 Toon Moene <toon@moene.indiv.nluug.nl>
* g77.texi: Split off invoke.texi (preliminary to using it
to generate a man page).
* Make-lang.in: Reflect in build rules.
From-SVN: r46775
-rw-r--r-- | gcc/f/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/f/Make-lang.in | 4 | ||||
-rw-r--r-- | gcc/f/g77.texi | 2065 | ||||
-rw-r--r-- | gcc/f/invoke.texi | 2064 |
4 files changed, 2073 insertions, 2066 deletions
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 23a7e07..725ba35 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +2001-11-04 Toon Moene <toon@moene.indiv.nluug.nl> + + * g77.texi: Split off invoke.texi (preliminary to using it + to generate a man page). + * Make-lang.in: Reflect in build rules. + Fri Nov 2 10:51:34 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * com.c (ffecom_initialize_char_syntax_, U_CHAR, is_idchar, diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in index e11793e..8894958 100644 --- a/gcc/f/Make-lang.in +++ b/gcc/f/Make-lang.in @@ -170,7 +170,7 @@ f77.dvi: f/g77.dvi # g77 documentation. $(srcdir)/f/g77.info: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \ - $(srcdir)/f/ffe.texi \ + $(srcdir)/f/ffe.texi $(srcdir)/f/invoke.texi \ $(srcdir)/f/news.texi $(srcdir)/f/intdoc.texi \ $(srcdir)/f/root.texi $(srcdir)/doc/include/fdl.texi \ $(srcdir)/doc/include/gpl.texi \ @@ -185,7 +185,7 @@ $(srcdir)/f/g77.info: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \ else true; fi f/g77.dvi: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \ - $(srcdir)/f/ffe.texi \ + $(srcdir)/f/ffe.texi $(srcdir)/f/invoke.texi \ $(srcdir)/f/news.texi $(srcdir)/f/intdoc.texi \ $(srcdir)/f/root.texi $(srcdir)/doc/include/fdl.texi \ $(srcdir)/doc/include/gpl.texi \ diff --git a/gcc/f/g77.texi b/gcc/f/g77.texi index 1ff671f..49a1516 100644 --- a/gcc/f/g77.texi +++ b/gcc/f/g77.texi @@ -889,2070 +889,7 @@ one is not the default. * Environment Variables:: Env vars that affect GNU Fortran. @end menu -@node Option Summary -@section Option Summary - -Here is a summary of all the options specific to GNU Fortran, grouped -by type. Explanations are in the following sections. - -@table @emph -@item Overall Options -@xref{Overall Options,,Options Controlling the Kind of Output}. -@smallexample --fversion -fset-g77-defaults -fno-silent -@end smallexample - -@item Shorthand Options -@xref{Shorthand Options}. -@smallexample --ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly -@end smallexample - -@item Fortran Language Options -@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}. -@smallexample --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 --ffixed-line-length-@var{n} -ffixed-line-length-none -@end smallexample - -@item Warning Options -@xref{Warning Options,,Options to Request or Suppress Warnings}. -@smallexample --fsyntax-only -pedantic -pedantic-errors -fpedantic --w -Wno-globals -Wimplicit -Wunused -Wuninitialized --Wall -Wsurprising --Werror -W -@end smallexample - -@item Debugging Options -@xref{Debugging Options,,Options for Debugging Your Program or GCC}. -@smallexample --g -@end smallexample - -@item Optimization Options -@xref{Optimize Options,,Options that Control Optimization}. -@smallexample --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 --fno-rerun-loop-opt -@end smallexample - -@item Directory Options -@xref{Directory Options,,Options for Directory Search}. -@smallexample --I@var{dir} -I- -@end smallexample - -@item Code Generation Options -@xref{Code Gen Options,,Options for Code Generation Conventions}. -@smallexample --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 --fbounds-check -ffortran-bounds-check -@end smallexample -@end table - -@menu -* Overall Options:: Controlling the kind of output: - an executable, object files, assembler files, - or preprocessed source. -* Shorthand Options:: Options that are shorthand for other options. -* Fortran Dialect Options:: Controlling the variant of Fortran language - compiled. -* Warning Options:: How picky should the compiler be? -* Debugging Options:: Symbol tables, measurements, and debugging dumps. -* Optimize Options:: How much optimization? -* Preprocessor Options:: Controlling header files and macro definitions. - Also, getting dependency information for Make. -* Directory Options:: Where to find header files and libraries. - Where to find the compiler executable files. -* Code Gen Options:: Specifying conventions for function calls, data layout - and register usage. -@end menu - -@node Overall Options -@section Options Controlling the Kind of Output -@cindex overall options -@cindex options, overall - -Compilation can involve as many as four stages: preprocessing, code -generation (often what is really meant by the term ``compilation''), -assembly, and linking, always in that order. The first three -stages apply to an individual source file, and end by producing an -object file; linking combines all the object files (those newly -compiled, and those specified as input) into an executable file. - -@cindex file name suffix -@cindex suffixes, file name -@cindex file name extension -@cindex extensions, file name -@cindex file type -@cindex types, file -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. - -@table @code -@cindex .f filename suffix -@cindex .for filename suffix -@cindex .FOR filename suffix -@item @var{file}.f -@item @var{file}.for -@item @var{file}.FOR -Fortran source code that should not be preprocessed. - -Such source code cannot contain any preprocessor directives, such -as @code{#include}, @code{#define}, @code{#if}, and so on. - -You can force @samp{.f} files to be preprocessed by @code{cpp} by using -@samp{-x f77-cpp-input}. -@xref{LEX}. - -@cindex preprocessor -@cindex C preprocessor -@cindex cpp preprocessor -@cindex Fortran preprocessor -@cindex cpp program -@cindex programs, cpp -@cindex .F filename suffix -@cindex .fpp filename suffix -@cindex .FPP filename suffix -@item @var{file}.F -@item @var{file}.fpp -@item @var{file}.FPP -Fortran source code that must be preprocessed (by the C preprocessor -@code{cpp}, which is part of GNU CC). - -Note that preprocessing is not extended to the contents of -files included by the @code{INCLUDE} directive---the @code{#include} -preprocessor directive must be used instead. - -@cindex Ratfor preprocessor -@cindex programs, @code{ratfor} -@cindex @samp{.r} filename suffix -@cindex @code{ratfor} -@item @var{file}.r -Ratfor source code, which must be preprocessed by the @code{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 @code{g77}, is at -@uref{ftp://members.aol.com/n8tm/rat7.uue} (of uncertain copyright -status). Another, public domain version in C is at -@uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}. -@end table - -UNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F} -nomenclature. -Users of other operating systems, especially those that cannot -distinguish upper-case -letters from lower-case letters in their file names, typically use -the @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature. - -@cindex #define -@cindex #include -@cindex #if -Use of the preprocessor @code{cpp} allows use of C-like -constructs such as @code{#define} and @code{#include}, but can -lead to unexpected, even mistaken, results due to Fortran's source file -format. -It is recommended that use of the C preprocessor -be limited to @code{#include} and, in -conjunction with @code{#define}, only @code{#if} and related directives, -thus avoiding in-line macro expansion entirely. -This recommendation applies especially -when using the traditional fixed source form. -With free source form, -fewer unexpected transformations are likely to happen, but use of -constructs such as Hollerith and character constants can nevertheless -present problems, especially when these are continued across multiple -source lines. -These problems result, primarily, from differences between the way -such constants are interpreted by the C preprocessor and by a Fortran -compiler. - -Another example of a problem that results from using the C preprocessor -is that a Fortran comment line that happens to contain any -characters ``interesting'' to the C preprocessor, -such as a backslash at the end of the line, -is not recognized by the preprocessor as a comment line, -so instead of being passed through ``raw'', -the line is edited according to the rules for the preprocessor. -For example, the backslash at the end of the line is removed, -along with the subsequent newline, resulting in the next -line being effectively commented out---unfortunate if that -line is a non-comment line of important code! - -@emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied -to @code{cpp} by default, to help avoid unpleasant surprises. -@xref{Preprocessor Options,,Options Controlling the Preprocessor, -gcc,Using and Porting GNU CC}. -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 -substitution by C predefines. -Thus, if you want to do system-specific -tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}. -Use the @samp{-v} option to see exactly how the preprocessor is invoked. - -@cindex /* -Unfortunately, the @samp{-traditional} flag will not avoid an error from -anything that @code{cpp} sees as an unterminated C comment, such as: -@smallexample -C Some Fortran compilers accept /* as starting -C an inline comment. -@end smallexample -@xref{Trailing Comment}. - -The following options that affect overall processing are recognized -by the @code{g77} and @code{gcc} commands in a GNU Fortran installation: - -@table @code -@cindex -fversion option -@cindex options, -fversion -@cindex printing version information -@cindex version information, printing -@cindex consistency checks -@cindex internal consistency checks -@cindex checks, of internal consistency -@item -fversion -Ensure that the @code{g77}-specific version of the compiler phase is reported, -if run, -and, starting in @code{egcs} version 1.1, -that internal consistency checks in the @file{f771} program are run. - -This option is supplied automatically when @samp{-v} or @samp{--verbose} -is specified as a command-line option for @code{g77} or @code{gcc} -and when the resulting commands compile Fortran source files. - -@cindex -fset-g77-defaults option -@cindex options, -fset-g77-defaults -@item -fset-g77-defaults -@emph{Version info:} -This option was obsolete as of @code{egcs} -version 1.1. -The effect is instead achieved -by the @code{lang_init_options} routine -in @file{gcc/gcc/f/com.c}. - -@cindex consistency checks -@cindex internal consistency checks -@cindex checks, of internal consistency -Set up whatever @code{gcc} options are to apply to Fortran -compilations, and avoid running internal consistency checks -that might take some time. - -This option is supplied automatically when compiling Fortran code -via the @code{g77} or @code{gcc} command. -The description of this option is provided so that users seeing -it in the output of, say, @samp{g77 -v} understand why it is -there. - -@cindex modifying g77 -@cindex code, modifying -Also, developers who run @code{f771} directly might want to specify it -by hand to get the same defaults as they would running @code{f771} -via @code{g77} or @code{gcc}. -However, such developers should, after linking a new @code{f771} -executable, invoke it without this option once, -e.g. via @kbd{./f771 -quiet < /dev/null}, -to ensure that they have not introduced any -internal inconsistencies (such as in the table of -intrinsics) before proceeding---@code{g77} will crash -with a diagnostic if it detects an inconsistency. - -@cindex -fno-silent option -@cindex options, -fno-silent -@cindex f2c compatibility -@cindex compatibility, f2c -@cindex status, compilation -@cindex compilation, status -@cindex reporting compilation status -@cindex printing compilation status -@item -fno-silent -Print (to @code{stderr}) the names of the program units as -they are compiled, in a form similar to that used by popular -UNIX @code{f77} implementations and @code{f2c}. -@end table - -@xref{Overall Options,,Options Controlling the Kind of Output, -gcc,Using and Porting GNU CC}, for information -on more options that control the overall operation of the @code{gcc} command -(and, by extension, the @code{g77} command). - -@node Shorthand Options -@section Shorthand Options -@cindex shorthand options -@cindex options, shorthand -@cindex macro options -@cindex options, macro - -The following options serve as ``shorthand'' -for other options accepted by the compiler: - -@table @code -@cindex -fugly option -@cindex options, -fugly -@item -fugly -@cindex ugly features -@cindex features, ugly -@emph{Note:} This option is no longer supported. -The information, below, is provided to aid -in the conversion of old scripts. - -Specify that certain ``ugly'' constructs are to be quietly accepted. -Same as: - -@smallexample --fugly-args -fugly-assign -fugly-assumed --fugly-comma -fugly-complex -fugly-init --fugly-logint -@end smallexample - -These constructs are considered inappropriate to use in new -or well-maintained portable Fortran code, but widely used -in old code. -@xref{Distensions}, for more information. - -@cindex -fno-ugly option -@cindex options, -fno-ugly -@item -fno-ugly -@cindex ugly features -@cindex features, ugly -Specify that all ``ugly'' constructs are to be noisily rejected. -Same as: - -@smallexample --fno-ugly-args -fno-ugly-assign -fno-ugly-assumed --fno-ugly-comma -fno-ugly-complex -fno-ugly-init --fno-ugly-logint -@end smallexample - -@xref{Distensions}, for more information. - -@cindex -ff66 option -@cindex options, -ff66 -@item -ff66 -@cindex FORTRAN 66 -@cindex compatibility, FORTRAN 66 -Specify that the program is written in idiomatic FORTRAN 66. -Same as @samp{-fonetrip -fugly-assumed}. - -The @samp{-fno-f66} option is the inverse of @samp{-ff66}. -As such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}. - -The meaning of this option is likely to be refined as future -versions of @code{g77} provide more compatibility with other -existing and obsolete Fortran implementations. - -@cindex -ff77 option -@cindex options, -ff77 -@item -ff77 -@cindex UNIX f77 -@cindex f2c compatibility -@cindex compatibility, f2c -@cindex f77 compatibility -@cindex compatibility, f77 -Specify that the program is written in idiomatic UNIX FORTRAN 77 -and/or the dialect accepted by the @code{f2c} product. -Same as @samp{-fbackslash -fno-typeless-boz}. - -The meaning of this option is likely to be refined as future -versions of @code{g77} provide more compatibility with other -existing and obsolete Fortran implementations. - -@cindex -fno-f77 option -@cindex options, -fno-f77 -@item -fno-f77 -@cindex UNIX f77 -The @samp{-fno-f77} option is @emph{not} the inverse -of @samp{-ff77}. -It specifies that the program is not written in idiomatic UNIX -FORTRAN 77 or @code{f2c}, but in a more widely portable dialect. -@samp{-fno-f77} is the same as @samp{-fno-backslash}. - -The meaning of this option is likely to be refined as future -versions of @code{g77} provide more compatibility with other -existing and obsolete Fortran implementations. -@end table - -@node Fortran Dialect Options -@section Options Controlling Fortran Dialect -@cindex dialect options -@cindex language, dialect options -@cindex options, dialect - -The following options control the dialect of Fortran -that the compiler accepts: - -@table @code -@cindex -ffree-form option -@cindex options, -ffree-form -@cindex -fno-fixed-form option -@cindex options, -fno-fixed-form -@cindex source file format -@cindex free form -@cindex fixed form -@cindex Fortran 90, features -@item -ffree-form -@item -fno-fixed-form -Specify that the source file is written in free form -(introduced in Fortran 90) instead of the more-traditional fixed form. - -@cindex -ff90 option -@cindex options, -ff90 -@cindex Fortran 90, features -@item -ff90 -Allow certain Fortran-90 constructs. - -This option controls whether certain -Fortran 90 constructs are recognized. -(Other Fortran 90 constructs -might or might not be recognized depending on other options such as -@samp{-fvxt}, @samp{-ff90-intrinsics-enable}, and the -current level of support for Fortran 90.) - -@xref{Fortran 90}, for more information. - -@cindex -fvxt option -@cindex options, -fvxt -@item -fvxt -@cindex Fortran 90, features -@cindex VXT extensions -Specify the treatment of certain constructs that have different -meanings depending on whether the code is written in -GNU Fortran (based on FORTRAN 77 and akin to Fortran 90) -or VXT Fortran (more like VAX FORTRAN). - -The default is @samp{-fno-vxt}. -@samp{-fvxt} specifies that the VXT Fortran interpretations -for those constructs are to be chosen. - -@xref{VXT Fortran}, for more information. - -@cindex -fdollar-ok option -@cindex options, -fdollar-ok -@item -fdollar-ok -@cindex dollar sign -@cindex symbol names -@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 character constants -@cindex Hollerith constants -Specify that @samp{\} is not to be specially interpreted in character -and Hollerith constants a la C and many UNIX Fortran compilers. - -For example, with @samp{-fbackslash} in effect, @samp{A\nB} specifies -three characters, with the second one being newline. -With @samp{-fno-backslash}, it specifies four characters, -@samp{A}, @samp{\}, @samp{n}, and @samp{B}. - -Note that @code{g77} implements a fairly general form of backslash -processing that is incompatible with the narrower forms supported -by some other compilers. -For example, @samp{'A\003B'} is a three-character string in @code{g77}, -whereas other compilers that support backslash might not support -the three-octal-digit form, and thus treat that string as longer -than three characters. - -@xref{Backslash in Constants}, for -information on why @samp{-fbackslash} is the default -instead of @samp{-fno-backslash}. - -@cindex -fno-ugly-args option -@cindex options, -fno-ugly-args -@item -fno-ugly-args -Disallow passing Hollerith and typeless constants as actual -arguments (for example, @samp{CALL FOO(4HABCD)}). - -@xref{Ugly Implicit Argument Conversion}, for more information. - -@cindex -fugly-assign option -@cindex options, -fugly-assign -@item -fugly-assign -Use the same storage for a given variable regardless of -whether it is used to hold an assigned-statement label -(as in @samp{ASSIGN 10 TO I}) or used to hold numeric data -(as in @samp{I = 3}). - -@xref{Ugly Assigned Labels}, for more information. - -@cindex -fugly-assumed option -@cindex options, -fugly-assumed -@item -fugly-assumed -Assume any dummy array with a final dimension specified as @samp{1} -is really an assumed-size array, as if @samp{*} had been specified -for the final dimension instead of @samp{1}. - -For example, @samp{DIMENSION X(1)} is treated as if it -had read @samp{DIMENSION X(*)}. - -@xref{Ugly Assumed-Size Arrays}, for more information. - -@cindex -fugly-comma option -@cindex options, -fugly-comma -@item -fugly-comma -In an external-procedure invocation, -treat a trailing comma in the argument list -as specification of a trailing null argument, -and treat an empty argument list -as specification of a single null argument. - -For example, @samp{CALL FOO(,)} is treated as -@samp{CALL FOO(%VAL(0), %VAL(0))}. -That is, @emph{two} null arguments are specified -by the procedure call when @samp{-fugly-comma} is in force. -And @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}. - -The default behavior, @samp{-fno-ugly-comma}, is to ignore -a single trailing comma in an argument list. -So, by default, @samp{CALL FOO(X,)} is treated -exactly the same as @samp{CALL FOO(X)}. - -@xref{Ugly Null Arguments}, for more information. - -@cindex -fugly-complex option -@cindex options, -fugly-complex -@item -fugly-complex -Do not complain about @samp{REAL(@var{expr})} or -@samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX} -type other than @code{COMPLEX(KIND=1)}---usually -this is used to permit @code{COMPLEX(KIND=2)} -(@code{DOUBLE COMPLEX}) operands. - -The @samp{-ff90} option controls the interpretation -of this construct. - -@xref{Ugly Complex Part Extraction}, for more information. - -@cindex -fno-ugly-init option -@cindex options, -fno-ugly-init -@item -fno-ugly-init -Disallow use of Hollerith and typeless constants as initial -values (in @code{PARAMETER} and @code{DATA} statements), and -use of character constants to -initialize numeric types and vice versa. - -For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by -@samp{-fno-ugly-init}. - -@xref{Ugly Conversion of Initializers}, for more information. - -@cindex -fugly-logint option -@cindex options, -fugly-logint -@item -fugly-logint -Treat @code{INTEGER} and @code{LOGICAL} variables and -expressions as potential stand-ins for each other. - -For example, automatic conversion between @code{INTEGER} and -@code{LOGICAL} is enabled, for many contexts, via this option. - -@xref{Ugly Integer Conversions}, for more information. - -@cindex -fonetrip option -@cindex options, -fonetrip -@item -fonetrip -@cindex FORTRAN 66 -@cindex @code{DO} loops, one-trip -@cindex one-trip @code{DO} loops -@cindex @code{DO} loops, zero-trip -@cindex zero-trip @code{DO} loops -@cindex compatibility, FORTRAN 66 -Executable iterative @code{DO} loops are to be executed at -least once each time they are reached. - -ANSI FORTRAN 77 and more recent versions of the Fortran standard -specify that the body of an iterative @code{DO} loop is not executed -if the number of iterations calculated from the parameters of the -loop is less than 1. -(For example, @samp{DO 10 I = 1, 0}.) -Such a loop is called a @dfn{zero-trip loop}. - -Prior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops -such that the body of a loop would be executed at least once, even -if the iteration count was zero. -Fortran code written assuming this behavior is said to require -@dfn{one-trip loops}. -For example, some code written to the FORTRAN 66 standard -expects this behavior from its @code{DO} loops, although that -standard did not specify this behavior. - -The @samp{-fonetrip} option specifies that the source file(s) being -compiled require one-trip loops. - -This option affects only those loops specified by the (iterative) @code{DO} -statement and by implied-@code{DO} lists in I/O statements. -Loops specified by implied-@code{DO} lists in @code{DATA} and -specification (non-executable) statements are not affected. - -@cindex -ftypeless-boz option -@cindex options, -ftypeless-boz -@cindex prefix-radix constants -@cindex constants, prefix-radix -@cindex constants, types -@cindex types, constants -@item -ftypeless-boz -Specifies that prefix-radix non-decimal constants, such as -@samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}. - -You can test for yourself whether a particular compiler treats -the prefix form as @code{INTEGER(KIND=1)} or typeless by running the -following program: - -@smallexample -EQUIVALENCE (I, R) -R = Z'ABCD1234' -J = Z'ABCD1234' -IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS' -IF (J .NE. I) PRINT *, 'Prefix form is INTEGER' -END -@end smallexample - -Reports indicate that many compilers process this form as -@code{INTEGER(KIND=1)}, though a few as typeless, and at least one -based on a command-line option specifying some kind of -compatibility. - -@cindex -fintrin-case-initcap option -@cindex options, -fintrin-case-initcap -@item -fintrin-case-initcap -@cindex -fintrin-case-upper option -@cindex options, -fintrin-case-upper -@item -fintrin-case-upper -@cindex -fintrin-case-lower option -@cindex options, -fintrin-case-lower -@item -fintrin-case-lower -@cindex -fintrin-case-any option -@cindex options, -fintrin-case-any -@item -fintrin-case-any -Specify expected case for intrinsic names. -@samp{-fintrin-case-lower} is the default. - -@cindex -fmatch-case-initcap option -@cindex options, -fmatch-case-initcap -@item -fmatch-case-initcap -@cindex -fmatch-case-upper option -@cindex options, -fmatch-case-upper -@item -fmatch-case-upper -@cindex -fmatch-case-lower option -@cindex options, -fmatch-case-lower -@item -fmatch-case-lower -@cindex -fmatch-case-any option -@cindex options, -fmatch-case-any -@item -fmatch-case-any -Specify expected case for keywords. -@samp{-fmatch-case-lower} is the default. - -@cindex -fsource-case-upper option -@cindex options, -fsource-case-upper -@item -fsource-case-upper -@cindex -fsource-case-lower option -@cindex options, -fsource-case-lower -@item -fsource-case-lower -@cindex -fsource-case-preserve option -@cindex options, -fsource-case-preserve -@item -fsource-case-preserve -Specify whether source text other than character and Hollerith constants -is to be translated to uppercase, to lowercase, or preserved as is. -@samp{-fsource-case-lower} is the default. - -@cindex -fsymbol-case-initcap option -@cindex options, -fsymbol-case-initcap -@item -fsymbol-case-initcap -@cindex -fsymbol-case-upper option -@cindex options, -fsymbol-case-upper -@item -fsymbol-case-upper -@cindex -fsymbol-case-lower option -@cindex options, -fsymbol-case-lower -@item -fsymbol-case-lower -@cindex -fsymbol-case-any option -@cindex options, -fsymbol-case-any -@item -fsymbol-case-any -Specify valid cases for user-defined symbol names. -@samp{-fsymbol-case-any} is the default. - -@cindex -fcase-strict-upper option -@cindex options, -fcase-strict-upper -@item -fcase-strict-upper -Same as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve --fsymbol-case-upper}. -(Requires all pertinent source to be in uppercase.) - -@cindex -fcase-strict-lower option -@cindex options, -fcase-strict-lower -@item -fcase-strict-lower -Same as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve --fsymbol-case-lower}. -(Requires all pertinent source to be in lowercase.) - -@cindex -fcase-initcap option -@cindex options, -fcase-initcap -@item -fcase-initcap -Same as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve --fsymbol-case-initcap}. -(Requires all pertinent source to be in initial capitals, -as in @samp{Print *,SqRt(Value)}.) - -@cindex -fcase-upper option -@cindex options, -fcase-upper -@item -fcase-upper -Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper --fsymbol-case-any}. -(Maps all pertinent source to uppercase.) - -@cindex -fcase-lower option -@cindex options, -fcase-lower -@item -fcase-lower -Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower --fsymbol-case-any}. -(Maps all pertinent source to lowercase.) - -@cindex -fcase-preserve option -@cindex options, -fcase-preserve -@item -fcase-preserve -Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-preserve --fsymbol-case-any}. -(Preserves all case in user-defined symbols, -while allowing any-case matching of intrinsics and keywords. -For example, @samp{call Foo(i,I)} would pass two @emph{different} -variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.) - -@cindex -fbadu77-intrinsics-delete option -@cindex options, -fbadu77-intrinsics-delete -@item -fbadu77-intrinsics-delete -@cindex -fbadu77-intrinsics-hide option -@cindex options, -fbadu77-intrinsics-hide -@item -fbadu77-intrinsics-hide -@cindex -fbadu77-intrinsics-disable option -@cindex options, -fbadu77-intrinsics-disable -@item -fbadu77-intrinsics-disable -@cindex -fbadu77-intrinsics-enable option -@cindex options, -fbadu77-intrinsics-enable -@item -fbadu77-intrinsics-enable -@cindex @code{badu77} intrinsics -@cindex intrinsics, @code{badu77} -Specify status of UNIX intrinsics having inappropriate forms. -@samp{-fbadu77-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -ff2c-intrinsics-delete option -@cindex options, -ff2c-intrinsics-delete -@item -ff2c-intrinsics-delete -@cindex -ff2c-intrinsics-hide option -@cindex options, -ff2c-intrinsics-hide -@item -ff2c-intrinsics-hide -@cindex -ff2c-intrinsics-disable option -@cindex options, -ff2c-intrinsics-disable -@item -ff2c-intrinsics-disable -@cindex -ff2c-intrinsics-enable option -@cindex options, -ff2c-intrinsics-enable -@item -ff2c-intrinsics-enable -@cindex @code{f2c} intrinsics -@cindex intrinsics, @code{f2c} -Specify status of f2c-specific intrinsics. -@samp{-ff2c-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -ff90-intrinsics-delete option -@cindex options, -ff90-intrinsics-delete -@item -ff90-intrinsics-delete -@cindex -ff90-intrinsics-hide option -@cindex options, -ff90-intrinsics-hide -@item -ff90-intrinsics-hide -@cindex -ff90-intrinsics-disable option -@cindex options, -ff90-intrinsics-disable -@item -ff90-intrinsics-disable -@cindex -ff90-intrinsics-enable option -@cindex options, -ff90-intrinsics-enable -@item -ff90-intrinsics-enable -@cindex Fortran 90, intrinsics -@cindex intrinsics, Fortran 90 -Specify status of F90-specific intrinsics. -@samp{-ff90-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -fgnu-intrinsics-delete option -@cindex options, -fgnu-intrinsics-delete -@item -fgnu-intrinsics-delete -@cindex -fgnu-intrinsics-hide option -@cindex options, -fgnu-intrinsics-hide -@item -fgnu-intrinsics-hide -@cindex -fgnu-intrinsics-disable option -@cindex options, -fgnu-intrinsics-disable -@item -fgnu-intrinsics-disable -@cindex -fgnu-intrinsics-enable option -@cindex options, -fgnu-intrinsics-enable -@item -fgnu-intrinsics-enable -@cindex Digital Fortran features -@cindex @code{COMPLEX} intrinsics -@cindex intrinsics, @code{COMPLEX} -Specify status of Digital's COMPLEX-related intrinsics. -@samp{-fgnu-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -fmil-intrinsics-delete option -@cindex options, -fmil-intrinsics-delete -@item -fmil-intrinsics-delete -@cindex -fmil-intrinsics-hide option -@cindex options, -fmil-intrinsics-hide -@item -fmil-intrinsics-hide -@cindex -fmil-intrinsics-disable option -@cindex options, -fmil-intrinsics-disable -@item -fmil-intrinsics-disable -@cindex -fmil-intrinsics-enable option -@cindex options, -fmil-intrinsics-enable -@item -fmil-intrinsics-enable -@cindex MIL-STD 1753 -@cindex intrinsics, MIL-STD 1753 -Specify status of MIL-STD-1753-specific intrinsics. -@samp{-fmil-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -funix-intrinsics-delete option -@cindex options, -funix-intrinsics-delete -@item -funix-intrinsics-delete -@cindex -funix-intrinsics-hide option -@cindex options, -funix-intrinsics-hide -@item -funix-intrinsics-hide -@cindex -funix-intrinsics-disable option -@cindex options, -funix-intrinsics-disable -@item -funix-intrinsics-disable -@cindex -funix-intrinsics-enable option -@cindex options, -funix-intrinsics-enable -@item -funix-intrinsics-enable -@cindex UNIX intrinsics -@cindex intrinsics, UNIX -Specify status of UNIX intrinsics. -@samp{-funix-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -fvxt-intrinsics-delete option -@cindex options, -fvxt-intrinsics-delete -@item -fvxt-intrinsics-delete -@cindex -fvxt-intrinsics-hide option -@cindex options, -fvxt-intrinsics-hide -@item -fvxt-intrinsics-hide -@cindex -fvxt-intrinsics-disable option -@cindex options, -fvxt-intrinsics-disable -@item -fvxt-intrinsics-disable -@cindex -fvxt-intrinsics-enable option -@cindex options, -fvxt-intrinsics-enable -@item -fvxt-intrinsics-enable -@cindex VXT intrinsics -@cindex intrinsics, VXT -Specify status of VXT intrinsics. -@samp{-fvxt-intrinsics-enable} is the default. -@xref{Intrinsic Groups}. - -@cindex -ffixed-line-length-@var{n} option -@cindex options, -ffixed-line-length-@var{n} -@item -ffixed-line-length-@var{n} -@cindex source file format -@cindex lines, length -@cindex length of source lines -@cindex fixed form -@cindex limits, lengths of source lines -Set column after which characters are ignored in typical fixed-form -lines in the source file, and through which spaces are assumed (as -if padded to that length) after the ends of short fixed-form lines. - -@cindex card image -@cindex extended-source option -Popular values for @var{n} include 72 (the -standard and the default), 80 (card image), and 132 (corresponds -to ``extended-source'' options in some popular compilers). -@var{n} may be @samp{none}, meaning that the entire line is meaningful -and that continued character constants never have implicit spaces appended -to them to fill out the line. -@samp{-ffixed-line-length-0} means the same thing as -@samp{-ffixed-line-length-none}. - -@xref{Source Form}, for more information. -@end table - -@node Warning Options -@section Options to Request or Suppress Warnings -@cindex options, warnings -@cindex warnings, suppressing -@cindex messages, warning -@cindex suppressing warnings - -Warnings are diagnostic messages that report constructions which -are not inherently erroneous but which are risky or suggest there -might have been an error. - -You can request many specific warnings with options beginning @samp{-W}, -for example @samp{-Wimplicit} to request warnings on implicit -declarations. Each of these specific warning options also has a -negative form beginning @samp{-Wno-} to turn off warnings; -for example, @samp{-Wno-implicit}. This manual lists only one of the -two forms, whichever is not the default. - -These options control the amount and kinds of warnings produced by GNU -Fortran: - -@table @code -@cindex syntax checking -@cindex -fsyntax-only option -@cindex options, -fsyntax-only -@item -fsyntax-only -Check the code for syntax errors, but don't do anything beyond that. - -@cindex -pedantic option -@cindex options, -pedantic -@item -pedantic -Issue warnings for uses of extensions to ANSI FORTRAN 77. -@samp{-pedantic} also applies to C-language constructs where they -occur in GNU Fortran source files, such as use of @samp{\e} in a -character constant within a directive like @samp{#include}. - -Valid ANSI FORTRAN 77 programs should compile properly with or without -this option. -However, without this option, certain GNU extensions and traditional -Fortran features are supported as well. -With this option, many of them are rejected. - -Some users try to use @samp{-pedantic} to check programs for strict ANSI -conformance. -They soon find that it does not do quite what they want---it finds some -non-ANSI practices, but not all. -However, improvements to @code{g77} in this area are welcome. - -@cindex -pedantic-errors option -@cindex options, -pedantic-errors -@item -pedantic-errors -Like @samp{-pedantic}, except that errors are produced rather than -warnings. - -@cindex -fpedantic option -@cindex options, -fpedantic -@item -fpedantic -Like @samp{-pedantic}, but applies only to Fortran constructs. - -@cindex -w option -@cindex options, -w -@item -w -Inhibit all warning messages. - -@cindex -Wno-globals option -@cindex options, -Wno-globals -@item -Wno-globals -@cindex global names, warning -@cindex warnings, global names -Inhibit warnings about use of a name as both a global name -(a subroutine, function, or block data program unit, or a -common block) and implicitly as the name of an intrinsic -in a source file. - -Also inhibit warnings about inconsistent invocations and/or -definitions of global procedures (function and subroutines). -Such inconsistencies include different numbers of arguments -and different types of arguments. - -@cindex -Wimplicit option -@cindex options, -Wimplicit -@item -Wimplicit -@cindex implicit declaration, warning -@cindex warnings, implicit declaration -@cindex -u option -@cindex /WARNINGS=DECLARATIONS switch -@cindex IMPLICIT NONE, similar effect -@cindex effecting IMPLICIT NONE -Warn whenever a variable, array, or function is implicitly -declared. -Has an effect similar to using the @code{IMPLICIT NONE} statement -in every program unit. -(Some Fortran compilers provide this feature by an option -named @samp{-u} or @samp{/WARNINGS=DECLARATIONS}.) - -@cindex -Wunused option -@cindex options, -Wunused -@item -Wunused -@cindex unused variables -@cindex variables, unused -Warn whenever a variable is unused aside from its declaration. - -@cindex -Wuninitialized option -@cindex options, -Wuninitialized -@item -Wuninitialized -@cindex uninitialized variables -@cindex variables, uninitialized -Warn whenever an automatic variable is used without first being initialized. - -These warnings are possible only in optimizing compilation, -because they require data-flow information that is computed only -when optimizing. If you don't specify @samp{-O}, you simply won't -get these warnings. - -These warnings occur only for variables that are candidates for -register allocation. Therefore, they do not occur for a variable -@c that is declared @code{VOLATILE}, or -whose address is taken, or whose size -is other than 1, 2, 4 or 8 bytes. Also, they do not occur for -arrays, even when they are in registers. - -Note that there might be no warning about a variable that is used only -to compute a value that itself is never used, because such -computations may be deleted by data-flow analysis before the warnings -are printed. - -These warnings are made optional because GNU Fortran is not smart -enough to see all the reasons why the code might be correct -despite appearing to have an error. Here is one example of how -this can happen: - -@example -SUBROUTINE DISPAT(J) -IF (J.EQ.1) I=1 -IF (J.EQ.2) I=4 -IF (J.EQ.3) I=5 -CALL FOO(I) -END -@end example - -@noindent -If the value of @code{J} is always 1, 2 or 3, then @code{I} is -always initialized, but GNU Fortran doesn't know this. Here is -another common case: - -@example -SUBROUTINE MAYBE(FLAG) -LOGICAL FLAG -IF (FLAG) VALUE = 9.4 -@dots{} -IF (FLAG) PRINT *, VALUE -END -@end example - -@noindent -This has no bug because @code{VALUE} is used only if it is set. - -@cindex -Wall option -@cindex options, -Wall -@item -Wall -@cindex all warnings -@cindex warnings, all -The @samp{-Wunused} and @samp{-Wuninitialized} options combined. -These are all the -options which pertain to usage that we recommend avoiding and that we -believe is easy to avoid. -(As more warnings are added to @code{g77}, some might -be added to the list enabled by @samp{-Wall}.) -@end table - -The remaining @samp{-W@dots{}} options are not implied by @samp{-Wall} -because they warn about constructions that we consider reasonable to -use, on occasion, in clean programs. - -@table @code -@c @item -W -@c Print extra warning messages for these events: -@c -@c @itemize @bullet -@c @item -@c If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused -@c arguments. -@c -@c @end itemize -@c -@cindex -Wsurprising option -@cindex options, -Wsurprising -@item -Wsurprising -Warn about ``suspicious'' constructs that are interpreted -by the compiler in a way that might well be surprising to -someone reading the code. -These differences can result in subtle, compiler-dependent -(even machine-dependent) behavioral differences. -The constructs warned about include: - -@itemize @bullet -@item -Expressions having two arithmetic operators in a row, such -as @samp{X*-Y}. -Such a construct is nonstandard, and can produce -unexpected results in more complicated situations such -as @samp{X**-Y*Z}. -@code{g77}, along with many other compilers, interprets -this example differently than many programmers, and a few -other compilers. -Specifically, @code{g77} interprets @samp{X**-Y*Z} as -@samp{(X**(-Y))*Z}, while others might think it should -be interpreted as @samp{X**(-(Y*Z))}. - -A revealing example is the constant expression @samp{2**-2*1.}, -which @code{g77} evaluates to .25, while others might evaluate -it to 0., the difference resulting from the way precedence affects -type promotion. - -(The @samp{-fpedantic} option also warns about expressions -having two arithmetic operators in a row.) - -@item -Expressions with a unary minus followed by an operand and then -a binary operator other than plus or minus. -For example, @samp{-2**2} produces a warning, because -the precedence is @samp{-(2**2)}, yielding -4, not -@samp{(-2)**2}, which yields 4, and which might represent -what a programmer expects. - -An example of an expression producing different results -in a surprising way is @samp{-I*S}, where @var{I} holds -the value @samp{-2147483648} and @var{S} holds @samp{0.5}. -On many systems, negating @var{I} results in the same -value, not a positive number, because it is already the -lower bound of what an @code{INTEGER(KIND=1)} variable can hold. -So, the expression evaluates to a positive number, while -the ``expected'' interpretation, @samp{(-I)*S}, would -evaluate to a negative number. - -Even cases such as @samp{-I*J} produce warnings, -even though, in most configurations and situations, -there is no computational difference between the -results of the two interpretations---the purpose -of this warning is to warn about differing interpretations -and encourage a better style of coding, not to identify -only those places where bugs might exist in the user's -code. - -@cindex DO statement -@cindex statements, DO -@item -@code{DO} loops with @code{DO} variables that are not -of integral type---that is, using @code{REAL} -variables as loop control variables. -Although such loops can be written to work in the -``obvious'' way, the way @code{g77} is required by the -Fortran standard to interpret such code is likely to -be quite different from the way many programmers expect. -(This is true of all @code{DO} loops, but the differences -are pronounced for non-integral loop control variables.) - -@xref{Loops}, for more information. -@end itemize - -@cindex -Werror option -@cindex options, -Werror -@item -Werror -Make all warnings into errors. - -@cindex -W option -@cindex options, -W -@item -W -@cindex extra warnings -@cindex warnings, extra -Turns on ``extra warnings'' and, if optimization is specified -via @samp{-O}, the @samp{-Wuninitialized} option. -(This might change in future versions of @code{g77}.) - -``Extra warnings'' are issued for: - -@itemize @bullet -@item -@cindex unused parameters -@cindex parameters, unused -@cindex unused arguments -@cindex arguments, unused -@cindex unused dummies -@cindex dummies, unused -Unused parameters to a procedure (when @samp{-Wunused} also is -specified). - -@item -@cindex overflow -Overflows involving floating-point constants (not available -for certain configurations). -@end itemize -@end table - -@xref{Warning Options,,Options to Request or Suppress Warnings, -gcc,Using and Porting GNU CC}, for information on more options offered -by the GBE shared by @code{g77}, @code{gcc}, and other GNU compilers. - -Some of these have no effect when compiling programs written in Fortran: - -@table @code -@cindex -Wcomment option -@cindex options, -Wcomment -@item -Wcomment -@cindex -Wformat option -@cindex options, -Wformat -@item -Wformat -@cindex -Wparentheses option -@cindex options, -Wparentheses -@item -Wparentheses -@cindex -Wswitch option -@cindex options, -Wswitch -@item -Wswitch -@cindex -Wtraditional option -@cindex options, -Wtraditional -@item -Wtraditional -@cindex -Wshadow option -@cindex options, -Wshadow -@item -Wshadow -@cindex -Wid-clash-@var{len} option -@cindex options, -Wid-clash-@var{len} -@item -Wid-clash-@var{len} -@cindex -Wlarger-than-@var{len} option -@cindex options, -Wlarger-than-@var{len} -@item -Wlarger-than-@var{len} -@cindex -Wconversion option -@cindex options, -Wconversion -@item -Wconversion -@cindex -Waggregate-return option -@cindex options, -Waggregate-return -@item -Waggregate-return -@cindex -Wredundant-decls option -@cindex options, -Wredundant-decls -@item -Wredundant-decls -@cindex unsupported warnings -@cindex warnings, unsupported -These options all could have some relevant meaning for -GNU Fortran programs, but are not yet supported. -@end table - -@node Debugging Options -@section Options for Debugging Your Program or GNU Fortran -@cindex options, debugging -@cindex debugging information options - -GNU Fortran has various special options that are used for debugging -either your program or @code{g77}. - -@table @code -@cindex -g option -@cindex options, -g -@item -g -Produce debugging information in the operating system's native format -(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging -information. -@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. - -@node Optimize Options -@section Options That Control Optimization -@cindex optimize options -@cindex options, optimization - -Most Fortran users will want to use no optimization when -developing and testing programs, and use @samp{-O} or @samp{-O2} when -compiling programs for late-cycle testing and for production use. -However, note that certain diagnostics---such as for uninitialized -variables---depend on the flow analysis done by @samp{-O}, i.e.@: you -must use @samp{-O} or @samp{-O2} to get such diagnostics. - -The following flags have particular applicability when -compiling Fortran programs: - -@table @code -@cindex -malign-double option -@cindex options, -malign-double -@item -malign-double -(Intel x86 architecture only.) - -Noticeably improves performance of @code{g77} programs making -heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data -on some systems. -In particular, systems using Pentium, Pentium Pro, 586, and -686 implementations -of the i386 architecture execute programs faster when -@code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are -aligned on 64-bit boundaries -in memory. - -This option can, at least, make benchmark results more consistent -across various system configurations, versions of the program, -and data sets. - -@emph{Note:} The warning in the @code{gcc} documentation about -this option does not apply, generally speaking, to Fortran -code compiled by @code{g77}. - -@xref{Aligned Data}, for more information on alignment issues. - -@emph{Also also note:} The negative form of @samp{-malign-double} -is @samp{-mno-align-double}, not @samp{-benign-double}. - -@cindex -ffloat-store option -@cindex options, -ffloat-store -@item -ffloat-store -@cindex IEEE 754 conformance -@cindex conformance, IEEE 754 -@cindex floating-point, precision -Might help a Fortran program that depends on exact IEEE conformance on -some machines, but might slow down a program that doesn't. - -This option is effective when the floating-point unit is set to work in -IEEE 854 `extended precision'---as it typically is on x86 and m68k GNU -systems---rather than IEEE 754 double precision. @samp{-ffloat-store} -tries to remove the extra precision by spilling data from floating-point -registers into memory and this typically involves a big performance -hit. However, it doesn't affect intermediate results, so that it is -only partially effective. `Excess precision' is avoided in code like: -@smallexample -a = b + c -d = a * e -@end smallexample -but not in code like: -@smallexample - d = (b + c) * e -@end smallexample - -For another, potentially better, way of controlling the precision, -see @ref{Floating-point precision}. - -@cindex -fforce-mem option -@cindex options, -fforce-mem -@item -fforce-mem -@cindex -fforce-addr option -@cindex options, -fforce-addr -@item -fforce-addr -@cindex loops, speeding up -@cindex speed, of loops -Might improve optimization of loops. - -@cindex -fno-inline option -@cindex options, -fno-inline -@item -fno-inline -@cindex in-line code -@cindex compilation, in-line -@c DL: Only relevant for -O3? -Don't compile statement functions inline. -Might reduce the size of a program unit---which might be at -expense of some speed (though it should compile faster). -Note that if you are not optimizing, no functions can be expanded inline. - -@cindex -ffast-math option -@cindex options, -ffast-math -@item -ffast-math -@cindex IEEE 754 conformance -@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 @samp{-funsafe-math-optimizations}, and -@samp{-fno-trapping-math}. - -@cindex -funsafe-math-optimizations option -@cindex options, -funsafe-math-optimizations -@item -funsafe-math-optimizations -Allow optimizations that may be give incorrect results -for certain IEEE inputs. - -@cindex -fno-trapping-math option -@cindex options, -fno-trapping-math -@item -fno-trapping-math -Allow the compiler to assume that floating-point arithmetic -will not generate traps on any inputs. This is useful, for -example, when running a program using IEEE "non-stop" -floating-point arithmetic. - -@cindex -fstrength-reduce option -@cindex options, -fstrength-reduce -@item -fstrength-reduce -@cindex loops, speeding up -@cindex speed, of loops -@c DL: normally defaulted? -Might make some loops run faster. - -@cindex -frerun-cse-after-loop option -@cindex options, -frerun-cse-after-loop -@item -frerun-cse-after-loop -@cindex -fexpensive-optimizations option -@cindex options, -fexpensive-optimizations -@c DL: This is -O2? -@item -fexpensive-optimizations -@cindex -fdelayed-branch option -@cindex options, -fdelayed-branch -@item -fdelayed-branch -@cindex -fschedule-insns option -@cindex options, -fschedule-insns -@item -fschedule-insns -@cindex -fschedule-insns2 option -@cindex options, -fschedule-insns2 -@item -fschedule-insns2 -@cindex -fcaller-saves option -@cindex options, -fcaller-saves -@item -fcaller-saves -Might improve performance on some code. - -@cindex -funroll-loops option -@cindex options, -funroll-loops -@item -funroll-loops -@cindex loops, unrolling -@cindex unrolling loops -@cindex loops, optimizing -@cindex indexed (iterative) @code{DO} -@cindex iterative @code{DO} -@c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to -@c provide a suitable term -@c CB: I've decided on `iterative', for the time being, and changed -@c my previous, rather bizarre, use of `imperative' to that -@c (though `precomputed-trip' would be a more precise adjective) -Typically improves performance on code using iterative @code{DO} loops by -unrolling them and is probably generally appropriate for Fortran, though -it is not turned on at any optimization level. -Note that outer loop unrolling isn't done specifically; decisions about -whether to unroll a loop are made on the basis of its instruction count. - -@c DL: Fixme: This should obviously go somewhere else... -Also, no `loop discovery'@footnote{@dfn{loop discovery} refers to the -process by which a compiler, or indeed any reader of a program, -determines which portions of the program are more likely to be executed -repeatedly as it is being run. Such discovery typically is done early -when compiling using optimization techniques, so the ``discovered'' -loops get more attention---and more run-time resources, such as -registers---from the compiler. It is easy to ``discover'' loops that are -constructed out of looping constructs in the language -(such as Fortran's @code{DO}). For some programs, ``discovering'' loops -constructed out of lower-level constructs (such as @code{IF} and -@code{GOTO}) can lead to generation of more optimal code -than otherwise.} is done, so only loops written with @code{DO} -benefit from loop optimizations, including---but not limited -to---unrolling. Loops written with @code{IF} and @code{GOTO} are not -currently recognized as such. This option unrolls only iterative -@code{DO} loops, not @code{DO WHILE} loops. - -@cindex -funroll-all-loops option -@cindex options, -funroll-all-loops -@cindex DO WHILE -@item -funroll-all-loops -@c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct. -Probably improves performance on code using @code{DO WHILE} loops by -unrolling them in addition to iterative @code{DO} loops. In the absence -of @code{DO WHILE}, this option is equivalent to @samp{-funroll-loops} -but possibly slower. - -@item -fno-move-all-movables -@cindex -fno-move-all-movables option -@cindex options, -fno-move-all-movables -@item -fno-reduce-all-givs -@cindex -fno-reduce-all-givs option -@cindex options, -fno-reduce-all-givs -@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 @code{g77} based on @code{gcc} version 2.8. - -Each of these might improve performance on some code. - -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}). - -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 @code{gcc} command-line options. -@end table - -@xref{Optimize Options,,Options That Control Optimization, -gcc,Using and Porting GNU CC}, for more information on options -to optimize the generated machine code. - -@node Preprocessor Options -@section Options Controlling the Preprocessor -@cindex preprocessor options -@cindex options, preprocessor -@cindex cpp program -@cindex programs, cpp - -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. - -@cindex INCLUDE directive -@cindex directive, INCLUDE -Some of these options also affect how @code{g77} processes the -@code{INCLUDE} directive. -Since this directive is processed even when preprocessing -is not requested, it is not described in this section. -@xref{Directory Options,,Options for Directory Search}, for -information on how @code{g77} processes the @code{INCLUDE} directive. - -However, the @code{INCLUDE} directive does not apply -preprocessing to the contents of the included file itself. - -Therefore, any file that contains preprocessor directives -(such as @code{#include}, @code{#define}, and @code{#if}) -must be included via the @code{#include} directive, not -via the @code{INCLUDE} directive. -Therefore, any file containing preprocessor directives, -if included, is necessarily included by a file that itself -contains preprocessor directives. - -@node Directory Options -@section Options for Directory Search -@cindex directory, options -@cindex options, directory search -@cindex search path - -These options affect how the @code{cpp} preprocessor searches -for files specified via the @code{#include} directive. -Therefore, when compiling Fortran programs, they are meaningful -when the preprocessor is used. - -@cindex INCLUDE directive -@cindex directive, INCLUDE -Some of these options also affect how @code{g77} searches -for files specified via the @code{INCLUDE} directive, -although files included by that directive are not, -themselves, preprocessed. -These options are: - -@table @code -@cindex -I- option -@cindex options, -I- -@item -I- -@cindex -Idir option -@cindex options, -Idir -@item -I@var{dir} -@cindex directory, search paths for inclusion -@cindex inclusion, directory search paths for -@cindex search paths, for included files -@cindex paths, search -These affect interpretation of the @code{INCLUDE} directive -(as well as of the @code{#include} directive of the @code{cpp} -preprocessor). - -Note that @samp{-I@var{dir}} must be specified @emph{without} any -spaces between @samp{-I} and the directory name---that is, -@samp{-Ifoo/bar} is valid, but @samp{-I foo/bar} -is rejected by the @code{g77} compiler (though the preprocessor supports -the latter form). -@c this is due to toplev.c's inflexible option processing -Also note that the general behavior of @samp{-I} and -@code{INCLUDE} is pretty much the same as of @samp{-I} with -@code{#include} in the @code{cpp} preprocessor, with regard to -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 @samp{-I} option. -@end table - -@node Code Gen Options -@section Options for Code Generation Conventions -@cindex code generation, conventions -@cindex options, code generation -@cindex run-time, options - -These machine-independent options control the interface conventions -used in code generation. - -Most of them have both positive and negative forms; the negative form -of @samp{-ffoo} would be @samp{-fno-foo}. In the table below, only -one of the forms is listed---the one which is not the default. You -can figure out the other form by either removing @samp{no-} or adding -it. - -@table @code -@cindex -fno-automatic option -@cindex options, -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 @samp{-static}.) - -@cindex -finit-local-zero option -@cindex options, -finit-local-zero -@item -finit-local-zero -@cindex DATA statement -@cindex statements, DATA -@cindex initialization, of local variables -@cindex variables, initialization of -@cindex uninitialized variables -@cindex variables, uninitialized -Specify that variables and arrays that are local to a program unit -(not in a common block and not passed as an argument) are to be initialized -to binary zeros. - -Since there is a run-time penalty for initialization of variables -that are not given the @code{SAVE} attribute, it might be a -good idea to also use @samp{-fno-automatic} with @samp{-finit-local-zero}. - -@cindex -fno-f2c option -@cindex options, -fno-f2c -@item -fno-f2c -@cindex @code{f2c} compatibility -@cindex compatibility, @code{f2c} -Do not generate code designed to be compatible with code generated -by @code{f2c}; use the GNU calling conventions instead. - -The @code{f2c} calling conventions require functions that return -type @code{REAL(KIND=1)} 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 GNU calling conventions, such functions simply return -their results as they would in GNU C---@code{REAL(KIND=1)} functions -return the C type @code{float}, and @code{COMPLEX} functions -return the GNU C type @code{complex} (or its @code{struct} -equivalent). - -This does not affect the generation of code that interfaces with the -@code{libg2c} library. - -However, because the @code{libg2c} library uses @code{f2c} -calling conventions, @code{g77} rejects attempts to pass -intrinsics implemented by routines in this library as actual -arguments when @samp{-fno-f2c} is used, to avoid bugs when -they are actually called by code expecting the GNU calling -conventions to work. - -For example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is -rejected when @samp{-fno-f2c} is in force. -(Future versions of the @code{g77} run-time library might -offer routines that provide GNU-callable versions of the -routines that implement the @code{f2c}-callable intrinsics -that may be passed as actual arguments, so that -valid programs need not be rejected when @samp{-fno-f2c} -is used.) - -@strong{Caution:} If @samp{-fno-f2c} is used when compiling any -source file used in a program, it must be used when compiling -@emph{all} Fortran source files used in that program. - -@c seems kinda dumb to tell people about an option they can't use -- jcb -@c then again, we want users building future-compatible libraries with it. -@cindex -ff2c-library option -@cindex options, -ff2c-library -@item -ff2c-library -Specify that use of @code{libg2c} (or the original @code{libf2c}) -is required. -This is the default for the current version of @code{g77}. - -Currently it is not -valid to specify @samp{-fno-f2c-library}. -This option is provided so users can specify it in shell -scripts that build programs and libraries that require the -@code{libf2c} library, even when being compiled by future -versions of @code{g77} that might otherwise default to -generating code for an incompatible library. - -@cindex -fno-underscoring option -@cindex options, -fno-underscoring -@item -fno-underscoring -@cindex underscore -@cindex symbol names, underscores -@cindex transforming symbol names -@cindex symbol names, transforming -Do not transform names of entities specified in the Fortran -source file by appending underscores to them. - -With @samp{-funderscoring} in effect, @code{g77} appends two underscores -to names with underscores and one underscore to external names with -no underscores. (@code{g77} also appends two underscores to internal -names with underscores to avoid naming collisions with external names. -The @samp{-fno-second-underscore} option disables appending of the -second underscore in all cases.) - -This is done to ensure compatibility with code produced by many -UNIX Fortran compilers, including @code{f2c}, which perform the -same transformations. - -Use of @samp{-fno-underscoring} is not recommended unless you are -experimenting with issues such as integration of (GNU) Fortran into -existing system environments (vis-a-vis existing libraries, tools, and -so on). - -For example, with @samp{-funderscoring}, and assuming other defaults like -@samp{-fcase-lower} and that @samp{j()} and @samp{max_count()} are -external functions while @samp{my_var} and @samp{lvar} are local variables, -a statement like - -@smallexample -I = J() + MAX_COUNT (MY_VAR, LVAR) -@end smallexample - -@noindent -is implemented as something akin to: - -@smallexample -i = j_() + max_count__(&my_var__, &lvar); -@end smallexample - -With @samp{-fno-underscoring}, the same statement is implemented as: - -@smallexample -i = j() + max_count(&my_var, &lvar); -@end smallexample - -Use of @samp{-fno-underscoring} allows direct specification of -user-defined names while debugging and when interfacing @code{g77}-compiled -code with other languages. - -Note that just because the names match does @emph{not} mean that the -interface implemented by @code{g77} for an external name matches the -interface implemented by some other language for that same name. -That is, getting code produced by @code{g77} to link to code produced -by some other compiler using this or any other method can be only a -small part of the overall solution---getting the code generated by -both compilers to agree on issues other than naming can require -significant effort, and, unlike naming disagreements, linkers normally -cannot detect disagreements in these other areas. - -Also, note that with @samp{-fno-underscoring}, the lack of appended -underscores introduces the very real possibility that a user-defined -external name will conflict with a name in a system library, which -could make finding unresolved-reference bugs quite difficult in some -cases---they might occur at program run time, and show up only as -buggy behavior at run time. - -In future versions of @code{g77}, we hope to improve naming and linking -issues so that debugging always involves using the names as they appear -in the source, even if the names as seen by the linker are mangled to -prevent accidental linking between procedures with incompatible -interfaces. - -@cindex -fno-second-underscore option -@cindex options, -fno-second-underscore -@item -fno-second-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. - -This option has no effect if @samp{-fno-underscoring} is -in effect. - -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__}. - -@cindex -fno-ident option -@cindex options, -fno-ident -@item -fno-ident -Ignore the @samp{#ident} directive. - -@cindex -fzeros option -@cindex options, -fzeros -@item -fzeros -Treat initial values of zero as if they were any other value. - -As of version 0.5.18, @code{g77} normally treats @code{DATA} and -other statements that are used to specify initial values of zero -for variables and arrays as if no values were actually specified, -in the sense that no diagnostics regarding multiple initializations -are produced. - -This is done to speed up compiling of programs that initialize -large arrays to zeros. - -Use @samp{-fzeros} to revert to the simpler, slower behavior -that can catch multiple initializations by keeping track of -all initializations, zero or otherwise. - -@emph{Caution:} Future versions of @code{g77} might disregard this option -(and its negative form, the default) or interpret it somewhat -differently. -The interpretation changes will affect only non-standard -programs; standard-conforming programs should not be affected. - -@cindex -femulate-complex option -@cindex options, -femulate-complex -@item -femulate-complex -Implement @code{COMPLEX} arithmetic via emulation, -instead of using the facilities of -the @code{gcc} back end that provide direct support of -@code{complex} arithmetic. - -(@code{gcc} had some bugs in its back-end support -for @code{complex} arithmetic, due primarily to the support not being -completed as of version 2.8.1 and @code{egcs} 1.1.2.) - -Use @samp{-femulate-complex} if you suspect code-generation bugs, -or experience compiler crashes, -that might result from @code{g77} using the @code{COMPLEX} support -in the @code{gcc} back end. -If using that option fixes the bugs or crashes you are seeing, -that indicates a likely @code{g77} bugs -(though, all compiler crashes are considered bugs), -so, please report it. -(Note that the known bugs, now believed fixed, produced compiler crashes -rather than causing the generation of incorrect code.) - -Use of this option should not affect how Fortran code compiled -by @code{g77} works in terms of its interfaces to other code, -e.g. that compiled by @code{f2c}. - -@emph{Caution:} Future versions of @code{g77} might ignore both forms -of this option. - -@cindex -falias-check option -@cindex options, -falias-check -@cindex -fargument-alias option -@cindex options, -fargument-alias -@cindex -fargument-noalias option -@cindex options, -fargument-noalias -@cindex -fno-argument-noalias-global option -@cindex options, -fno-argument-noalias-global -@item -falias-check -@item -fargument-alias -@item -fargument-noalias -@item -fno-argument-noalias-global -@emph{Version info:} -These options are not supported by -versions of @code{g77} based on @code{gcc} version 2.8. - -These options specify to what degree aliasing -(overlap) -is permitted between -arguments (passed as pointers) and @code{COMMON} (external, or -public) storage. - -The default for Fortran code, as mandated by the FORTRAN 77 and -Fortran 90 standards, is @samp{-fargument-noalias-global}. -The default for code written in the C language family is -@samp{-fargument-alias}. - -Note that, on some systems, compiling with @samp{-fforce-addr} in -effect can produce more optimal code when the default aliasing -options are in effect (and when optimization is enabled). - -@xref{Aliasing Assumed To Work}, for detailed information on the implications -of compiling Fortran code that depends on the ability to alias dummy -arguments. - -@cindex -fno-globals option -@cindex options, -fno-globals -@item -fno-globals -@cindex global names, warning -@cindex warnings, global names -@cindex in-line code -@cindex compilation, in-line -Disable diagnostics about inter-procedural -analysis problems, such as disagreements about the -type of a function or a procedure's argument, -that might cause a compiler crash when attempting -to inline a reference to a procedure within a -program unit. -(The diagnostics themselves are still produced, but -as warnings, unless @samp{-Wno-globals} is specified, -in which case no relevant diagnostics are produced.) - -Further, this option disables such inlining, to -avoid compiler crashes resulting from incorrect -code that would otherwise be diagnosed. - -As such, this option might be quite useful when -compiling existing, ``working'' code that happens -to have a few bugs that do not generally show themselves, -but which @code{g77} diagnoses. - -Use of this option therefore has the effect of -instructing @code{g77} to behave more like it did -up through version 0.5.19.1, when it paid little or -no attention to disagreements between program units -about a procedure's type and argument information, -and when it performed no inlining of procedures -(except statement functions). - -Without this option, @code{g77} defaults to performing -the potentially inlining procedures as it started doing -in version 0.5.20, but as of version 0.5.21, it also -diagnoses disagreements that might cause such inlining -to crash the compiler as (fatal) errors, -and warns about similar disagreements -that are currently believed to not -likely to result in the compiler later crashing -or producing incorrect code. - -@cindex -fflatten-arrays option -@item -fflatten-arrays -@cindex array performance -@cindex arrays, flattening -Use back end's C-like constructs -(pointer plus offset) -instead of its @code{ARRAY_REF} construct -to handle all array references. - -@emph{Note:} This option is not supported. -It is intended for use only by @code{g77} developers, -to evaluate code-generation issues. -It might be removed at any time. - -@cindex -fbounds-check option -@cindex -ffortran-bounds-check option -@item -fbounds-check -@itemx -ffortran-bounds-check -@cindex bounds checking -@cindex range checking -@cindex array bounds checking -@cindex subscript checking -@cindex substring checking -@cindex checking subscripts -@cindex checking substrings -Enable generation of run-time checks for array subscripts -and substring start and end points -against the (locally) declared minimum and maximum values. - -The current implementation uses the @code{libf2c} -library routine @code{s_rnge} to print the diagnostic. - -However, whereas @code{f2c} generates a single check per -reference for a multi-dimensional array, of the computed -offset against the valid offset range (0 through the size of the array), -@code{g77} generates a single check per @emph{subscript} expression. -This catches some cases of potential bugs that @code{f2c} does not, -such as references to below the beginning of an assumed-size array. - -@code{g77} also generates checks for @code{CHARACTER} substring references, -something @code{f2c} currently does not do. - -Use the new @samp{-ffortran-bounds-check} option -to specify bounds-checking for only the Fortran code you are compiling, -not necessarily for code written in other languages. - -@emph{Note:} To provide more detailed information on the offending subscript, -@code{g77} provides the @code{libg2c} run-time library routine @code{s_rnge} -with somewhat differently-formatted information. -Here's a sample diagnostic: - -@smallexample -Subscript out of range on file line 4, procedure rnge.f/bf. -Attempt to access the -6-th element of variable b[subscript-2-of-2]. -Aborted -@end smallexample - -The above message indicates that the offending source line is -line 4 of the file @file{rnge.f}, -within the program unit (or statement function) named @samp{bf}. -The offended array is named @samp{b}. -The offended array dimension is the second for a two-dimensional array, -and the offending, computed subscript expression was @samp{-6}. - -For a @code{CHARACTER} substring reference, the second line has -this appearance: - -@smallexample -Attempt to access the 11-th element of variable a[start-substring]. -@end smallexample - -This indicates that the offended @code{CHARACTER} variable or array -is named @samp{a}, -the offended substring position is the starting (leftmost) position, -and the offending substring expression is @samp{11}. - -(Though the verbage of @code{s_rnge} is not ideal -for the purpose of the @code{g77} compiler, -the above information should provide adequate diagnostic abilities -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 -offered by the GBE -shared by @code{g77}, @code{gcc}, and other GNU compilers. - -Some of these do @emph{not} work when compiling programs written in Fortran: - -@table @code -@cindex -fpcc-struct-return option -@cindex options, -fpcc-struct-return -@item -fpcc-struct-return -@cindex -freg-struct-return option -@cindex options, -freg-struct-return -@item -freg-struct-return -You should not use these except strictly the same way as you -used them to build the version of @code{libg2c} with which -you will be linking all code compiled by @code{g77} with the -same option. - -@cindex -fshort-double option -@cindex options, -fshort-double -@item -fshort-double -This probably either has no effect on Fortran programs, or -makes them act loopy. - -@cindex -fno-common option -@cindex options, -fno-common -@item -fno-common -Do not use this when compiling Fortran programs, -or there will be Trouble. - -@cindex -fpack-struct option -@cindex options, -fpack-struct -@item -fpack-struct -This probably will break any calls to the @code{libg2c} library, -at the very least, even if it is built with the same option. -@end table - -@node Environment Variables -@section Environment Variables Affecting GNU Fortran -@cindex environment variables - -GNU Fortran currently does not make use of any environment -variables to control its operation above and beyond those -that affect the operation of @code{gcc}. - -@xref{Environment Variables,,Environment Variables Affecting GNU CC, -gcc,Using and Porting GNU CC}, for information on environment -variables. +@include invoke.texi @include news.texi diff --git a/gcc/f/invoke.texi b/gcc/f/invoke.texi new file mode 100644 index 0000000..08febaa --- /dev/null +++ b/gcc/f/invoke.texi @@ -0,0 +1,2064 @@ +@node Option Summary +@section Option Summary + +Here is a summary of all the options specific to GNU Fortran, grouped +by type. Explanations are in the following sections. + +@table @emph +@item Overall Options +@xref{Overall Options,,Options Controlling the Kind of Output}. +@smallexample +-fversion -fset-g77-defaults -fno-silent +@end smallexample + +@item Shorthand Options +@xref{Shorthand Options}. +@smallexample +-ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly +@end smallexample + +@item Fortran Language Options +@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}. +@smallexample +-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 +-ffixed-line-length-@var{n} -ffixed-line-length-none +@end smallexample + +@item Warning Options +@xref{Warning Options,,Options to Request or Suppress Warnings}. +@smallexample +-fsyntax-only -pedantic -pedantic-errors -fpedantic +-w -Wno-globals -Wimplicit -Wunused -Wuninitialized +-Wall -Wsurprising +-Werror -W +@end smallexample + +@item Debugging Options +@xref{Debugging Options,,Options for Debugging Your Program or GCC}. +@smallexample +-g +@end smallexample + +@item Optimization Options +@xref{Optimize Options,,Options that Control Optimization}. +@smallexample +-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 +-fno-rerun-loop-opt +@end smallexample + +@item Directory Options +@xref{Directory Options,,Options for Directory Search}. +@smallexample +-I@var{dir} -I- +@end smallexample + +@item Code Generation Options +@xref{Code Gen Options,,Options for Code Generation Conventions}. +@smallexample +-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 +-fbounds-check -ffortran-bounds-check +@end smallexample +@end table + +@menu +* Overall Options:: Controlling the kind of output: + an executable, object files, assembler files, + or preprocessed source. +* Shorthand Options:: Options that are shorthand for other options. +* Fortran Dialect Options:: Controlling the variant of Fortran language + compiled. +* Warning Options:: How picky should the compiler be? +* Debugging Options:: Symbol tables, measurements, and debugging dumps. +* Optimize Options:: How much optimization? +* Preprocessor Options:: Controlling header files and macro definitions. + Also, getting dependency information for Make. +* Directory Options:: Where to find header files and libraries. + Where to find the compiler executable files. +* Code Gen Options:: Specifying conventions for function calls, data layout + and register usage. +@end menu + +@node Overall Options +@section Options Controlling the Kind of Output +@cindex overall options +@cindex options, overall + +Compilation can involve as many as four stages: preprocessing, code +generation (often what is really meant by the term ``compilation''), +assembly, and linking, always in that order. The first three +stages apply to an individual source file, and end by producing an +object file; linking combines all the object files (those newly +compiled, and those specified as input) into an executable file. + +@cindex file name suffix +@cindex suffixes, file name +@cindex file name extension +@cindex extensions, file name +@cindex file type +@cindex types, file +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. + +@table @code +@cindex .f filename suffix +@cindex .for filename suffix +@cindex .FOR filename suffix +@item @var{file}.f +@item @var{file}.for +@item @var{file}.FOR +Fortran source code that should not be preprocessed. + +Such source code cannot contain any preprocessor directives, such +as @code{#include}, @code{#define}, @code{#if}, and so on. + +You can force @samp{.f} files to be preprocessed by @code{cpp} by using +@samp{-x f77-cpp-input}. +@xref{LEX}. + +@cindex preprocessor +@cindex C preprocessor +@cindex cpp preprocessor +@cindex Fortran preprocessor +@cindex cpp program +@cindex programs, cpp +@cindex .F filename suffix +@cindex .fpp filename suffix +@cindex .FPP filename suffix +@item @var{file}.F +@item @var{file}.fpp +@item @var{file}.FPP +Fortran source code that must be preprocessed (by the C preprocessor +@code{cpp}, which is part of GNU CC). + +Note that preprocessing is not extended to the contents of +files included by the @code{INCLUDE} directive---the @code{#include} +preprocessor directive must be used instead. + +@cindex Ratfor preprocessor +@cindex programs, @code{ratfor} +@cindex @samp{.r} filename suffix +@cindex @code{ratfor} +@item @var{file}.r +Ratfor source code, which must be preprocessed by the @code{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 @code{g77}, is at +@uref{ftp://members.aol.com/n8tm/rat7.uue} (of uncertain copyright +status). Another, public domain version in C is at +@uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}. +@end table + +UNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F} +nomenclature. +Users of other operating systems, especially those that cannot +distinguish upper-case +letters from lower-case letters in their file names, typically use +the @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature. + +@cindex #define +@cindex #include +@cindex #if +Use of the preprocessor @code{cpp} allows use of C-like +constructs such as @code{#define} and @code{#include}, but can +lead to unexpected, even mistaken, results due to Fortran's source file +format. +It is recommended that use of the C preprocessor +be limited to @code{#include} and, in +conjunction with @code{#define}, only @code{#if} and related directives, +thus avoiding in-line macro expansion entirely. +This recommendation applies especially +when using the traditional fixed source form. +With free source form, +fewer unexpected transformations are likely to happen, but use of +constructs such as Hollerith and character constants can nevertheless +present problems, especially when these are continued across multiple +source lines. +These problems result, primarily, from differences between the way +such constants are interpreted by the C preprocessor and by a Fortran +compiler. + +Another example of a problem that results from using the C preprocessor +is that a Fortran comment line that happens to contain any +characters ``interesting'' to the C preprocessor, +such as a backslash at the end of the line, +is not recognized by the preprocessor as a comment line, +so instead of being passed through ``raw'', +the line is edited according to the rules for the preprocessor. +For example, the backslash at the end of the line is removed, +along with the subsequent newline, resulting in the next +line being effectively commented out---unfortunate if that +line is a non-comment line of important code! + +@emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied +to @code{cpp} by default, to help avoid unpleasant surprises. +@xref{Preprocessor Options,,Options Controlling the Preprocessor, +gcc,Using and Porting GNU CC}. +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 +substitution by C predefines. +Thus, if you want to do system-specific +tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}. +Use the @samp{-v} option to see exactly how the preprocessor is invoked. + +@cindex /* +Unfortunately, the @samp{-traditional} flag will not avoid an error from +anything that @code{cpp} sees as an unterminated C comment, such as: +@smallexample +C Some Fortran compilers accept /* as starting +C an inline comment. +@end smallexample +@xref{Trailing Comment}. + +The following options that affect overall processing are recognized +by the @code{g77} and @code{gcc} commands in a GNU Fortran installation: + +@table @code +@cindex -fversion option +@cindex options, -fversion +@cindex printing version information +@cindex version information, printing +@cindex consistency checks +@cindex internal consistency checks +@cindex checks, of internal consistency +@item -fversion +Ensure that the @code{g77}-specific version of the compiler phase is reported, +if run, +and, starting in @code{egcs} version 1.1, +that internal consistency checks in the @file{f771} program are run. + +This option is supplied automatically when @samp{-v} or @samp{--verbose} +is specified as a command-line option for @code{g77} or @code{gcc} +and when the resulting commands compile Fortran source files. + +@cindex -fset-g77-defaults option +@cindex options, -fset-g77-defaults +@item -fset-g77-defaults +@emph{Version info:} +This option was obsolete as of @code{egcs} +version 1.1. +The effect is instead achieved +by the @code{lang_init_options} routine +in @file{gcc/gcc/f/com.c}. + +@cindex consistency checks +@cindex internal consistency checks +@cindex checks, of internal consistency +Set up whatever @code{gcc} options are to apply to Fortran +compilations, and avoid running internal consistency checks +that might take some time. + +This option is supplied automatically when compiling Fortran code +via the @code{g77} or @code{gcc} command. +The description of this option is provided so that users seeing +it in the output of, say, @samp{g77 -v} understand why it is +there. + +@cindex modifying g77 +@cindex code, modifying +Also, developers who run @code{f771} directly might want to specify it +by hand to get the same defaults as they would running @code{f771} +via @code{g77} or @code{gcc}. +However, such developers should, after linking a new @code{f771} +executable, invoke it without this option once, +e.g. via @kbd{./f771 -quiet < /dev/null}, +to ensure that they have not introduced any +internal inconsistencies (such as in the table of +intrinsics) before proceeding---@code{g77} will crash +with a diagnostic if it detects an inconsistency. + +@cindex -fno-silent option +@cindex options, -fno-silent +@cindex f2c compatibility +@cindex compatibility, f2c +@cindex status, compilation +@cindex compilation, status +@cindex reporting compilation status +@cindex printing compilation status +@item -fno-silent +Print (to @code{stderr}) the names of the program units as +they are compiled, in a form similar to that used by popular +UNIX @code{f77} implementations and @code{f2c}. +@end table + +@xref{Overall Options,,Options Controlling the Kind of Output, +gcc,Using and Porting GNU CC}, for information +on more options that control the overall operation of the @code{gcc} command +(and, by extension, the @code{g77} command). + +@node Shorthand Options +@section Shorthand Options +@cindex shorthand options +@cindex options, shorthand +@cindex macro options +@cindex options, macro + +The following options serve as ``shorthand'' +for other options accepted by the compiler: + +@table @code +@cindex -fugly option +@cindex options, -fugly +@item -fugly +@cindex ugly features +@cindex features, ugly +@emph{Note:} This option is no longer supported. +The information, below, is provided to aid +in the conversion of old scripts. + +Specify that certain ``ugly'' constructs are to be quietly accepted. +Same as: + +@smallexample +-fugly-args -fugly-assign -fugly-assumed +-fugly-comma -fugly-complex -fugly-init +-fugly-logint +@end smallexample + +These constructs are considered inappropriate to use in new +or well-maintained portable Fortran code, but widely used +in old code. +@xref{Distensions}, for more information. + +@cindex -fno-ugly option +@cindex options, -fno-ugly +@item -fno-ugly +@cindex ugly features +@cindex features, ugly +Specify that all ``ugly'' constructs are to be noisily rejected. +Same as: + +@smallexample +-fno-ugly-args -fno-ugly-assign -fno-ugly-assumed +-fno-ugly-comma -fno-ugly-complex -fno-ugly-init +-fno-ugly-logint +@end smallexample + +@xref{Distensions}, for more information. + +@cindex -ff66 option +@cindex options, -ff66 +@item -ff66 +@cindex FORTRAN 66 +@cindex compatibility, FORTRAN 66 +Specify that the program is written in idiomatic FORTRAN 66. +Same as @samp{-fonetrip -fugly-assumed}. + +The @samp{-fno-f66} option is the inverse of @samp{-ff66}. +As such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}. + +The meaning of this option is likely to be refined as future +versions of @code{g77} provide more compatibility with other +existing and obsolete Fortran implementations. + +@cindex -ff77 option +@cindex options, -ff77 +@item -ff77 +@cindex UNIX f77 +@cindex f2c compatibility +@cindex compatibility, f2c +@cindex f77 compatibility +@cindex compatibility, f77 +Specify that the program is written in idiomatic UNIX FORTRAN 77 +and/or the dialect accepted by the @code{f2c} product. +Same as @samp{-fbackslash -fno-typeless-boz}. + +The meaning of this option is likely to be refined as future +versions of @code{g77} provide more compatibility with other +existing and obsolete Fortran implementations. + +@cindex -fno-f77 option +@cindex options, -fno-f77 +@item -fno-f77 +@cindex UNIX f77 +The @samp{-fno-f77} option is @emph{not} the inverse +of @samp{-ff77}. +It specifies that the program is not written in idiomatic UNIX +FORTRAN 77 or @code{f2c}, but in a more widely portable dialect. +@samp{-fno-f77} is the same as @samp{-fno-backslash}. + +The meaning of this option is likely to be refined as future +versions of @code{g77} provide more compatibility with other +existing and obsolete Fortran implementations. +@end table + +@node Fortran Dialect Options +@section Options Controlling Fortran Dialect +@cindex dialect options +@cindex language, dialect options +@cindex options, dialect + +The following options control the dialect of Fortran +that the compiler accepts: + +@table @code +@cindex -ffree-form option +@cindex options, -ffree-form +@cindex -fno-fixed-form option +@cindex options, -fno-fixed-form +@cindex source file format +@cindex free form +@cindex fixed form +@cindex Fortran 90, features +@item -ffree-form +@item -fno-fixed-form +Specify that the source file is written in free form +(introduced in Fortran 90) instead of the more-traditional fixed form. + +@cindex -ff90 option +@cindex options, -ff90 +@cindex Fortran 90, features +@item -ff90 +Allow certain Fortran-90 constructs. + +This option controls whether certain +Fortran 90 constructs are recognized. +(Other Fortran 90 constructs +might or might not be recognized depending on other options such as +@samp{-fvxt}, @samp{-ff90-intrinsics-enable}, and the +current level of support for Fortran 90.) + +@xref{Fortran 90}, for more information. + +@cindex -fvxt option +@cindex options, -fvxt +@item -fvxt +@cindex Fortran 90, features +@cindex VXT extensions +Specify the treatment of certain constructs that have different +meanings depending on whether the code is written in +GNU Fortran (based on FORTRAN 77 and akin to Fortran 90) +or VXT Fortran (more like VAX FORTRAN). + +The default is @samp{-fno-vxt}. +@samp{-fvxt} specifies that the VXT Fortran interpretations +for those constructs are to be chosen. + +@xref{VXT Fortran}, for more information. + +@cindex -fdollar-ok option +@cindex options, -fdollar-ok +@item -fdollar-ok +@cindex dollar sign +@cindex symbol names +@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 character constants +@cindex Hollerith constants +Specify that @samp{\} is not to be specially interpreted in character +and Hollerith constants a la C and many UNIX Fortran compilers. + +For example, with @samp{-fbackslash} in effect, @samp{A\nB} specifies +three characters, with the second one being newline. +With @samp{-fno-backslash}, it specifies four characters, +@samp{A}, @samp{\}, @samp{n}, and @samp{B}. + +Note that @code{g77} implements a fairly general form of backslash +processing that is incompatible with the narrower forms supported +by some other compilers. +For example, @samp{'A\003B'} is a three-character string in @code{g77}, +whereas other compilers that support backslash might not support +the three-octal-digit form, and thus treat that string as longer +than three characters. + +@xref{Backslash in Constants}, for +information on why @samp{-fbackslash} is the default +instead of @samp{-fno-backslash}. + +@cindex -fno-ugly-args option +@cindex options, -fno-ugly-args +@item -fno-ugly-args +Disallow passing Hollerith and typeless constants as actual +arguments (for example, @samp{CALL FOO(4HABCD)}). + +@xref{Ugly Implicit Argument Conversion}, for more information. + +@cindex -fugly-assign option +@cindex options, -fugly-assign +@item -fugly-assign +Use the same storage for a given variable regardless of +whether it is used to hold an assigned-statement label +(as in @samp{ASSIGN 10 TO I}) or used to hold numeric data +(as in @samp{I = 3}). + +@xref{Ugly Assigned Labels}, for more information. + +@cindex -fugly-assumed option +@cindex options, -fugly-assumed +@item -fugly-assumed +Assume any dummy array with a final dimension specified as @samp{1} +is really an assumed-size array, as if @samp{*} had been specified +for the final dimension instead of @samp{1}. + +For example, @samp{DIMENSION X(1)} is treated as if it +had read @samp{DIMENSION X(*)}. + +@xref{Ugly Assumed-Size Arrays}, for more information. + +@cindex -fugly-comma option +@cindex options, -fugly-comma +@item -fugly-comma +In an external-procedure invocation, +treat a trailing comma in the argument list +as specification of a trailing null argument, +and treat an empty argument list +as specification of a single null argument. + +For example, @samp{CALL FOO(,)} is treated as +@samp{CALL FOO(%VAL(0), %VAL(0))}. +That is, @emph{two} null arguments are specified +by the procedure call when @samp{-fugly-comma} is in force. +And @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}. + +The default behavior, @samp{-fno-ugly-comma}, is to ignore +a single trailing comma in an argument list. +So, by default, @samp{CALL FOO(X,)} is treated +exactly the same as @samp{CALL FOO(X)}. + +@xref{Ugly Null Arguments}, for more information. + +@cindex -fugly-complex option +@cindex options, -fugly-complex +@item -fugly-complex +Do not complain about @samp{REAL(@var{expr})} or +@samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX} +type other than @code{COMPLEX(KIND=1)}---usually +this is used to permit @code{COMPLEX(KIND=2)} +(@code{DOUBLE COMPLEX}) operands. + +The @samp{-ff90} option controls the interpretation +of this construct. + +@xref{Ugly Complex Part Extraction}, for more information. + +@cindex -fno-ugly-init option +@cindex options, -fno-ugly-init +@item -fno-ugly-init +Disallow use of Hollerith and typeless constants as initial +values (in @code{PARAMETER} and @code{DATA} statements), and +use of character constants to +initialize numeric types and vice versa. + +For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by +@samp{-fno-ugly-init}. + +@xref{Ugly Conversion of Initializers}, for more information. + +@cindex -fugly-logint option +@cindex options, -fugly-logint +@item -fugly-logint +Treat @code{INTEGER} and @code{LOGICAL} variables and +expressions as potential stand-ins for each other. + +For example, automatic conversion between @code{INTEGER} and +@code{LOGICAL} is enabled, for many contexts, via this option. + +@xref{Ugly Integer Conversions}, for more information. + +@cindex -fonetrip option +@cindex options, -fonetrip +@item -fonetrip +@cindex FORTRAN 66 +@cindex @code{DO} loops, one-trip +@cindex one-trip @code{DO} loops +@cindex @code{DO} loops, zero-trip +@cindex zero-trip @code{DO} loops +@cindex compatibility, FORTRAN 66 +Executable iterative @code{DO} loops are to be executed at +least once each time they are reached. + +ANSI FORTRAN 77 and more recent versions of the Fortran standard +specify that the body of an iterative @code{DO} loop is not executed +if the number of iterations calculated from the parameters of the +loop is less than 1. +(For example, @samp{DO 10 I = 1, 0}.) +Such a loop is called a @dfn{zero-trip loop}. + +Prior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops +such that the body of a loop would be executed at least once, even +if the iteration count was zero. +Fortran code written assuming this behavior is said to require +@dfn{one-trip loops}. +For example, some code written to the FORTRAN 66 standard +expects this behavior from its @code{DO} loops, although that +standard did not specify this behavior. + +The @samp{-fonetrip} option specifies that the source file(s) being +compiled require one-trip loops. + +This option affects only those loops specified by the (iterative) @code{DO} +statement and by implied-@code{DO} lists in I/O statements. +Loops specified by implied-@code{DO} lists in @code{DATA} and +specification (non-executable) statements are not affected. + +@cindex -ftypeless-boz option +@cindex options, -ftypeless-boz +@cindex prefix-radix constants +@cindex constants, prefix-radix +@cindex constants, types +@cindex types, constants +@item -ftypeless-boz +Specifies that prefix-radix non-decimal constants, such as +@samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}. + +You can test for yourself whether a particular compiler treats +the prefix form as @code{INTEGER(KIND=1)} or typeless by running the +following program: + +@smallexample +EQUIVALENCE (I, R) +R = Z'ABCD1234' +J = Z'ABCD1234' +IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS' +IF (J .NE. I) PRINT *, 'Prefix form is INTEGER' +END +@end smallexample + +Reports indicate that many compilers process this form as +@code{INTEGER(KIND=1)}, though a few as typeless, and at least one +based on a command-line option specifying some kind of +compatibility. + +@cindex -fintrin-case-initcap option +@cindex options, -fintrin-case-initcap +@item -fintrin-case-initcap +@cindex -fintrin-case-upper option +@cindex options, -fintrin-case-upper +@item -fintrin-case-upper +@cindex -fintrin-case-lower option +@cindex options, -fintrin-case-lower +@item -fintrin-case-lower +@cindex -fintrin-case-any option +@cindex options, -fintrin-case-any +@item -fintrin-case-any +Specify expected case for intrinsic names. +@samp{-fintrin-case-lower} is the default. + +@cindex -fmatch-case-initcap option +@cindex options, -fmatch-case-initcap +@item -fmatch-case-initcap +@cindex -fmatch-case-upper option +@cindex options, -fmatch-case-upper +@item -fmatch-case-upper +@cindex -fmatch-case-lower option +@cindex options, -fmatch-case-lower +@item -fmatch-case-lower +@cindex -fmatch-case-any option +@cindex options, -fmatch-case-any +@item -fmatch-case-any +Specify expected case for keywords. +@samp{-fmatch-case-lower} is the default. + +@cindex -fsource-case-upper option +@cindex options, -fsource-case-upper +@item -fsource-case-upper +@cindex -fsource-case-lower option +@cindex options, -fsource-case-lower +@item -fsource-case-lower +@cindex -fsource-case-preserve option +@cindex options, -fsource-case-preserve +@item -fsource-case-preserve +Specify whether source text other than character and Hollerith constants +is to be translated to uppercase, to lowercase, or preserved as is. +@samp{-fsource-case-lower} is the default. + +@cindex -fsymbol-case-initcap option +@cindex options, -fsymbol-case-initcap +@item -fsymbol-case-initcap +@cindex -fsymbol-case-upper option +@cindex options, -fsymbol-case-upper +@item -fsymbol-case-upper +@cindex -fsymbol-case-lower option +@cindex options, -fsymbol-case-lower +@item -fsymbol-case-lower +@cindex -fsymbol-case-any option +@cindex options, -fsymbol-case-any +@item -fsymbol-case-any +Specify valid cases for user-defined symbol names. +@samp{-fsymbol-case-any} is the default. + +@cindex -fcase-strict-upper option +@cindex options, -fcase-strict-upper +@item -fcase-strict-upper +Same as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve +-fsymbol-case-upper}. +(Requires all pertinent source to be in uppercase.) + +@cindex -fcase-strict-lower option +@cindex options, -fcase-strict-lower +@item -fcase-strict-lower +Same as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve +-fsymbol-case-lower}. +(Requires all pertinent source to be in lowercase.) + +@cindex -fcase-initcap option +@cindex options, -fcase-initcap +@item -fcase-initcap +Same as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve +-fsymbol-case-initcap}. +(Requires all pertinent source to be in initial capitals, +as in @samp{Print *,SqRt(Value)}.) + +@cindex -fcase-upper option +@cindex options, -fcase-upper +@item -fcase-upper +Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper +-fsymbol-case-any}. +(Maps all pertinent source to uppercase.) + +@cindex -fcase-lower option +@cindex options, -fcase-lower +@item -fcase-lower +Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower +-fsymbol-case-any}. +(Maps all pertinent source to lowercase.) + +@cindex -fcase-preserve option +@cindex options, -fcase-preserve +@item -fcase-preserve +Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-preserve +-fsymbol-case-any}. +(Preserves all case in user-defined symbols, +while allowing any-case matching of intrinsics and keywords. +For example, @samp{call Foo(i,I)} would pass two @emph{different} +variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.) + +@cindex -fbadu77-intrinsics-delete option +@cindex options, -fbadu77-intrinsics-delete +@item -fbadu77-intrinsics-delete +@cindex -fbadu77-intrinsics-hide option +@cindex options, -fbadu77-intrinsics-hide +@item -fbadu77-intrinsics-hide +@cindex -fbadu77-intrinsics-disable option +@cindex options, -fbadu77-intrinsics-disable +@item -fbadu77-intrinsics-disable +@cindex -fbadu77-intrinsics-enable option +@cindex options, -fbadu77-intrinsics-enable +@item -fbadu77-intrinsics-enable +@cindex @code{badu77} intrinsics +@cindex intrinsics, @code{badu77} +Specify status of UNIX intrinsics having inappropriate forms. +@samp{-fbadu77-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -ff2c-intrinsics-delete option +@cindex options, -ff2c-intrinsics-delete +@item -ff2c-intrinsics-delete +@cindex -ff2c-intrinsics-hide option +@cindex options, -ff2c-intrinsics-hide +@item -ff2c-intrinsics-hide +@cindex -ff2c-intrinsics-disable option +@cindex options, -ff2c-intrinsics-disable +@item -ff2c-intrinsics-disable +@cindex -ff2c-intrinsics-enable option +@cindex options, -ff2c-intrinsics-enable +@item -ff2c-intrinsics-enable +@cindex @code{f2c} intrinsics +@cindex intrinsics, @code{f2c} +Specify status of f2c-specific intrinsics. +@samp{-ff2c-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -ff90-intrinsics-delete option +@cindex options, -ff90-intrinsics-delete +@item -ff90-intrinsics-delete +@cindex -ff90-intrinsics-hide option +@cindex options, -ff90-intrinsics-hide +@item -ff90-intrinsics-hide +@cindex -ff90-intrinsics-disable option +@cindex options, -ff90-intrinsics-disable +@item -ff90-intrinsics-disable +@cindex -ff90-intrinsics-enable option +@cindex options, -ff90-intrinsics-enable +@item -ff90-intrinsics-enable +@cindex Fortran 90, intrinsics +@cindex intrinsics, Fortran 90 +Specify status of F90-specific intrinsics. +@samp{-ff90-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -fgnu-intrinsics-delete option +@cindex options, -fgnu-intrinsics-delete +@item -fgnu-intrinsics-delete +@cindex -fgnu-intrinsics-hide option +@cindex options, -fgnu-intrinsics-hide +@item -fgnu-intrinsics-hide +@cindex -fgnu-intrinsics-disable option +@cindex options, -fgnu-intrinsics-disable +@item -fgnu-intrinsics-disable +@cindex -fgnu-intrinsics-enable option +@cindex options, -fgnu-intrinsics-enable +@item -fgnu-intrinsics-enable +@cindex Digital Fortran features +@cindex @code{COMPLEX} intrinsics +@cindex intrinsics, @code{COMPLEX} +Specify status of Digital's COMPLEX-related intrinsics. +@samp{-fgnu-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -fmil-intrinsics-delete option +@cindex options, -fmil-intrinsics-delete +@item -fmil-intrinsics-delete +@cindex -fmil-intrinsics-hide option +@cindex options, -fmil-intrinsics-hide +@item -fmil-intrinsics-hide +@cindex -fmil-intrinsics-disable option +@cindex options, -fmil-intrinsics-disable +@item -fmil-intrinsics-disable +@cindex -fmil-intrinsics-enable option +@cindex options, -fmil-intrinsics-enable +@item -fmil-intrinsics-enable +@cindex MIL-STD 1753 +@cindex intrinsics, MIL-STD 1753 +Specify status of MIL-STD-1753-specific intrinsics. +@samp{-fmil-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -funix-intrinsics-delete option +@cindex options, -funix-intrinsics-delete +@item -funix-intrinsics-delete +@cindex -funix-intrinsics-hide option +@cindex options, -funix-intrinsics-hide +@item -funix-intrinsics-hide +@cindex -funix-intrinsics-disable option +@cindex options, -funix-intrinsics-disable +@item -funix-intrinsics-disable +@cindex -funix-intrinsics-enable option +@cindex options, -funix-intrinsics-enable +@item -funix-intrinsics-enable +@cindex UNIX intrinsics +@cindex intrinsics, UNIX +Specify status of UNIX intrinsics. +@samp{-funix-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -fvxt-intrinsics-delete option +@cindex options, -fvxt-intrinsics-delete +@item -fvxt-intrinsics-delete +@cindex -fvxt-intrinsics-hide option +@cindex options, -fvxt-intrinsics-hide +@item -fvxt-intrinsics-hide +@cindex -fvxt-intrinsics-disable option +@cindex options, -fvxt-intrinsics-disable +@item -fvxt-intrinsics-disable +@cindex -fvxt-intrinsics-enable option +@cindex options, -fvxt-intrinsics-enable +@item -fvxt-intrinsics-enable +@cindex VXT intrinsics +@cindex intrinsics, VXT +Specify status of VXT intrinsics. +@samp{-fvxt-intrinsics-enable} is the default. +@xref{Intrinsic Groups}. + +@cindex -ffixed-line-length-@var{n} option +@cindex options, -ffixed-line-length-@var{n} +@item -ffixed-line-length-@var{n} +@cindex source file format +@cindex lines, length +@cindex length of source lines +@cindex fixed form +@cindex limits, lengths of source lines +Set column after which characters are ignored in typical fixed-form +lines in the source file, and through which spaces are assumed (as +if padded to that length) after the ends of short fixed-form lines. + +@cindex card image +@cindex extended-source option +Popular values for @var{n} include 72 (the +standard and the default), 80 (card image), and 132 (corresponds +to ``extended-source'' options in some popular compilers). +@var{n} may be @samp{none}, meaning that the entire line is meaningful +and that continued character constants never have implicit spaces appended +to them to fill out the line. +@samp{-ffixed-line-length-0} means the same thing as +@samp{-ffixed-line-length-none}. + +@xref{Source Form}, for more information. +@end table + +@node Warning Options +@section Options to Request or Suppress Warnings +@cindex options, warnings +@cindex warnings, suppressing +@cindex messages, warning +@cindex suppressing warnings + +Warnings are diagnostic messages that report constructions which +are not inherently erroneous but which are risky or suggest there +might have been an error. + +You can request many specific warnings with options beginning @samp{-W}, +for example @samp{-Wimplicit} to request warnings on implicit +declarations. Each of these specific warning options also has a +negative form beginning @samp{-Wno-} to turn off warnings; +for example, @samp{-Wno-implicit}. This manual lists only one of the +two forms, whichever is not the default. + +These options control the amount and kinds of warnings produced by GNU +Fortran: + +@table @code +@cindex syntax checking +@cindex -fsyntax-only option +@cindex options, -fsyntax-only +@item -fsyntax-only +Check the code for syntax errors, but don't do anything beyond that. + +@cindex -pedantic option +@cindex options, -pedantic +@item -pedantic +Issue warnings for uses of extensions to ANSI FORTRAN 77. +@samp{-pedantic} also applies to C-language constructs where they +occur in GNU Fortran source files, such as use of @samp{\e} in a +character constant within a directive like @samp{#include}. + +Valid ANSI FORTRAN 77 programs should compile properly with or without +this option. +However, without this option, certain GNU extensions and traditional +Fortran features are supported as well. +With this option, many of them are rejected. + +Some users try to use @samp{-pedantic} to check programs for strict ANSI +conformance. +They soon find that it does not do quite what they want---it finds some +non-ANSI practices, but not all. +However, improvements to @code{g77} in this area are welcome. + +@cindex -pedantic-errors option +@cindex options, -pedantic-errors +@item -pedantic-errors +Like @samp{-pedantic}, except that errors are produced rather than +warnings. + +@cindex -fpedantic option +@cindex options, -fpedantic +@item -fpedantic +Like @samp{-pedantic}, but applies only to Fortran constructs. + +@cindex -w option +@cindex options, -w +@item -w +Inhibit all warning messages. + +@cindex -Wno-globals option +@cindex options, -Wno-globals +@item -Wno-globals +@cindex global names, warning +@cindex warnings, global names +Inhibit warnings about use of a name as both a global name +(a subroutine, function, or block data program unit, or a +common block) and implicitly as the name of an intrinsic +in a source file. + +Also inhibit warnings about inconsistent invocations and/or +definitions of global procedures (function and subroutines). +Such inconsistencies include different numbers of arguments +and different types of arguments. + +@cindex -Wimplicit option +@cindex options, -Wimplicit +@item -Wimplicit +@cindex implicit declaration, warning +@cindex warnings, implicit declaration +@cindex -u option +@cindex /WARNINGS=DECLARATIONS switch +@cindex IMPLICIT NONE, similar effect +@cindex effecting IMPLICIT NONE +Warn whenever a variable, array, or function is implicitly +declared. +Has an effect similar to using the @code{IMPLICIT NONE} statement +in every program unit. +(Some Fortran compilers provide this feature by an option +named @samp{-u} or @samp{/WARNINGS=DECLARATIONS}.) + +@cindex -Wunused option +@cindex options, -Wunused +@item -Wunused +@cindex unused variables +@cindex variables, unused +Warn whenever a variable is unused aside from its declaration. + +@cindex -Wuninitialized option +@cindex options, -Wuninitialized +@item -Wuninitialized +@cindex uninitialized variables +@cindex variables, uninitialized +Warn whenever an automatic variable is used without first being initialized. + +These warnings are possible only in optimizing compilation, +because they require data-flow information that is computed only +when optimizing. If you don't specify @samp{-O}, you simply won't +get these warnings. + +These warnings occur only for variables that are candidates for +register allocation. Therefore, they do not occur for a variable +@c that is declared @code{VOLATILE}, or +whose address is taken, or whose size +is other than 1, 2, 4 or 8 bytes. Also, they do not occur for +arrays, even when they are in registers. + +Note that there might be no warning about a variable that is used only +to compute a value that itself is never used, because such +computations may be deleted by data-flow analysis before the warnings +are printed. + +These warnings are made optional because GNU Fortran is not smart +enough to see all the reasons why the code might be correct +despite appearing to have an error. Here is one example of how +this can happen: + +@example +SUBROUTINE DISPAT(J) +IF (J.EQ.1) I=1 +IF (J.EQ.2) I=4 +IF (J.EQ.3) I=5 +CALL FOO(I) +END +@end example + +@noindent +If the value of @code{J} is always 1, 2 or 3, then @code{I} is +always initialized, but GNU Fortran doesn't know this. Here is +another common case: + +@example +SUBROUTINE MAYBE(FLAG) +LOGICAL FLAG +IF (FLAG) VALUE = 9.4 +@dots{} +IF (FLAG) PRINT *, VALUE +END +@end example + +@noindent +This has no bug because @code{VALUE} is used only if it is set. + +@cindex -Wall option +@cindex options, -Wall +@item -Wall +@cindex all warnings +@cindex warnings, all +The @samp{-Wunused} and @samp{-Wuninitialized} options combined. +These are all the +options which pertain to usage that we recommend avoiding and that we +believe is easy to avoid. +(As more warnings are added to @code{g77}, some might +be added to the list enabled by @samp{-Wall}.) +@end table + +The remaining @samp{-W@dots{}} options are not implied by @samp{-Wall} +because they warn about constructions that we consider reasonable to +use, on occasion, in clean programs. + +@table @code +@c @item -W +@c Print extra warning messages for these events: +@c +@c @itemize @bullet +@c @item +@c If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused +@c arguments. +@c +@c @end itemize +@c +@cindex -Wsurprising option +@cindex options, -Wsurprising +@item -Wsurprising +Warn about ``suspicious'' constructs that are interpreted +by the compiler in a way that might well be surprising to +someone reading the code. +These differences can result in subtle, compiler-dependent +(even machine-dependent) behavioral differences. +The constructs warned about include: + +@itemize @bullet +@item +Expressions having two arithmetic operators in a row, such +as @samp{X*-Y}. +Such a construct is nonstandard, and can produce +unexpected results in more complicated situations such +as @samp{X**-Y*Z}. +@code{g77}, along with many other compilers, interprets +this example differently than many programmers, and a few +other compilers. +Specifically, @code{g77} interprets @samp{X**-Y*Z} as +@samp{(X**(-Y))*Z}, while others might think it should +be interpreted as @samp{X**(-(Y*Z))}. + +A revealing example is the constant expression @samp{2**-2*1.}, +which @code{g77} evaluates to .25, while others might evaluate +it to 0., the difference resulting from the way precedence affects +type promotion. + +(The @samp{-fpedantic} option also warns about expressions +having two arithmetic operators in a row.) + +@item +Expressions with a unary minus followed by an operand and then +a binary operator other than plus or minus. +For example, @samp{-2**2} produces a warning, because +the precedence is @samp{-(2**2)}, yielding -4, not +@samp{(-2)**2}, which yields 4, and which might represent +what a programmer expects. + +An example of an expression producing different results +in a surprising way is @samp{-I*S}, where @var{I} holds +the value @samp{-2147483648} and @var{S} holds @samp{0.5}. +On many systems, negating @var{I} results in the same +value, not a positive number, because it is already the +lower bound of what an @code{INTEGER(KIND=1)} variable can hold. +So, the expression evaluates to a positive number, while +the ``expected'' interpretation, @samp{(-I)*S}, would +evaluate to a negative number. + +Even cases such as @samp{-I*J} produce warnings, +even though, in most configurations and situations, +there is no computational difference between the +results of the two interpretations---the purpose +of this warning is to warn about differing interpretations +and encourage a better style of coding, not to identify +only those places where bugs might exist in the user's +code. + +@cindex DO statement +@cindex statements, DO +@item +@code{DO} loops with @code{DO} variables that are not +of integral type---that is, using @code{REAL} +variables as loop control variables. +Although such loops can be written to work in the +``obvious'' way, the way @code{g77} is required by the +Fortran standard to interpret such code is likely to +be quite different from the way many programmers expect. +(This is true of all @code{DO} loops, but the differences +are pronounced for non-integral loop control variables.) + +@xref{Loops}, for more information. +@end itemize + +@cindex -Werror option +@cindex options, -Werror +@item -Werror +Make all warnings into errors. + +@cindex -W option +@cindex options, -W +@item -W +@cindex extra warnings +@cindex warnings, extra +Turns on ``extra warnings'' and, if optimization is specified +via @samp{-O}, the @samp{-Wuninitialized} option. +(This might change in future versions of @code{g77}.) + +``Extra warnings'' are issued for: + +@itemize @bullet +@item +@cindex unused parameters +@cindex parameters, unused +@cindex unused arguments +@cindex arguments, unused +@cindex unused dummies +@cindex dummies, unused +Unused parameters to a procedure (when @samp{-Wunused} also is +specified). + +@item +@cindex overflow +Overflows involving floating-point constants (not available +for certain configurations). +@end itemize +@end table + +@xref{Warning Options,,Options to Request or Suppress Warnings, +gcc,Using and Porting GNU CC}, for information on more options offered +by the GBE shared by @code{g77}, @code{gcc}, and other GNU compilers. + +Some of these have no effect when compiling programs written in Fortran: + +@table @code +@cindex -Wcomment option +@cindex options, -Wcomment +@item -Wcomment +@cindex -Wformat option +@cindex options, -Wformat +@item -Wformat +@cindex -Wparentheses option +@cindex options, -Wparentheses +@item -Wparentheses +@cindex -Wswitch option +@cindex options, -Wswitch +@item -Wswitch +@cindex -Wtraditional option +@cindex options, -Wtraditional +@item -Wtraditional +@cindex -Wshadow option +@cindex options, -Wshadow +@item -Wshadow +@cindex -Wid-clash-@var{len} option +@cindex options, -Wid-clash-@var{len} +@item -Wid-clash-@var{len} +@cindex -Wlarger-than-@var{len} option +@cindex options, -Wlarger-than-@var{len} +@item -Wlarger-than-@var{len} +@cindex -Wconversion option +@cindex options, -Wconversion +@item -Wconversion +@cindex -Waggregate-return option +@cindex options, -Waggregate-return +@item -Waggregate-return +@cindex -Wredundant-decls option +@cindex options, -Wredundant-decls +@item -Wredundant-decls +@cindex unsupported warnings +@cindex warnings, unsupported +These options all could have some relevant meaning for +GNU Fortran programs, but are not yet supported. +@end table + +@node Debugging Options +@section Options for Debugging Your Program or GNU Fortran +@cindex options, debugging +@cindex debugging information options + +GNU Fortran has various special options that are used for debugging +either your program or @code{g77}. + +@table @code +@cindex -g option +@cindex options, -g +@item -g +Produce debugging information in the operating system's native format +(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging +information. +@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. + +@node Optimize Options +@section Options That Control Optimization +@cindex optimize options +@cindex options, optimization + +Most Fortran users will want to use no optimization when +developing and testing programs, and use @samp{-O} or @samp{-O2} when +compiling programs for late-cycle testing and for production use. +However, note that certain diagnostics---such as for uninitialized +variables---depend on the flow analysis done by @samp{-O}, i.e.@: you +must use @samp{-O} or @samp{-O2} to get such diagnostics. + +The following flags have particular applicability when +compiling Fortran programs: + +@table @code +@cindex -malign-double option +@cindex options, -malign-double +@item -malign-double +(Intel x86 architecture only.) + +Noticeably improves performance of @code{g77} programs making +heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data +on some systems. +In particular, systems using Pentium, Pentium Pro, 586, and +686 implementations +of the i386 architecture execute programs faster when +@code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are +aligned on 64-bit boundaries +in memory. + +This option can, at least, make benchmark results more consistent +across various system configurations, versions of the program, +and data sets. + +@emph{Note:} The warning in the @code{gcc} documentation about +this option does not apply, generally speaking, to Fortran +code compiled by @code{g77}. + +@xref{Aligned Data}, for more information on alignment issues. + +@emph{Also also note:} The negative form of @samp{-malign-double} +is @samp{-mno-align-double}, not @samp{-benign-double}. + +@cindex -ffloat-store option +@cindex options, -ffloat-store +@item -ffloat-store +@cindex IEEE 754 conformance +@cindex conformance, IEEE 754 +@cindex floating-point, precision +Might help a Fortran program that depends on exact IEEE conformance on +some machines, but might slow down a program that doesn't. + +This option is effective when the floating-point unit is set to work in +IEEE 854 `extended precision'---as it typically is on x86 and m68k GNU +systems---rather than IEEE 754 double precision. @samp{-ffloat-store} +tries to remove the extra precision by spilling data from floating-point +registers into memory and this typically involves a big performance +hit. However, it doesn't affect intermediate results, so that it is +only partially effective. `Excess precision' is avoided in code like: +@smallexample +a = b + c +d = a * e +@end smallexample +but not in code like: +@smallexample + d = (b + c) * e +@end smallexample + +For another, potentially better, way of controlling the precision, +see @ref{Floating-point precision}. + +@cindex -fforce-mem option +@cindex options, -fforce-mem +@item -fforce-mem +@cindex -fforce-addr option +@cindex options, -fforce-addr +@item -fforce-addr +@cindex loops, speeding up +@cindex speed, of loops +Might improve optimization of loops. + +@cindex -fno-inline option +@cindex options, -fno-inline +@item -fno-inline +@cindex in-line code +@cindex compilation, in-line +@c DL: Only relevant for -O3? +Don't compile statement functions inline. +Might reduce the size of a program unit---which might be at +expense of some speed (though it should compile faster). +Note that if you are not optimizing, no functions can be expanded inline. + +@cindex -ffast-math option +@cindex options, -ffast-math +@item -ffast-math +@cindex IEEE 754 conformance +@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 @samp{-funsafe-math-optimizations}, and +@samp{-fno-trapping-math}. + +@cindex -funsafe-math-optimizations option +@cindex options, -funsafe-math-optimizations +@item -funsafe-math-optimizations +Allow optimizations that may be give incorrect results +for certain IEEE inputs. + +@cindex -fno-trapping-math option +@cindex options, -fno-trapping-math +@item -fno-trapping-math +Allow the compiler to assume that floating-point arithmetic +will not generate traps on any inputs. This is useful, for +example, when running a program using IEEE "non-stop" +floating-point arithmetic. + +@cindex -fstrength-reduce option +@cindex options, -fstrength-reduce +@item -fstrength-reduce +@cindex loops, speeding up +@cindex speed, of loops +@c DL: normally defaulted? +Might make some loops run faster. + +@cindex -frerun-cse-after-loop option +@cindex options, -frerun-cse-after-loop +@item -frerun-cse-after-loop +@cindex -fexpensive-optimizations option +@cindex options, -fexpensive-optimizations +@c DL: This is -O2? +@item -fexpensive-optimizations +@cindex -fdelayed-branch option +@cindex options, -fdelayed-branch +@item -fdelayed-branch +@cindex -fschedule-insns option +@cindex options, -fschedule-insns +@item -fschedule-insns +@cindex -fschedule-insns2 option +@cindex options, -fschedule-insns2 +@item -fschedule-insns2 +@cindex -fcaller-saves option +@cindex options, -fcaller-saves +@item -fcaller-saves +Might improve performance on some code. + +@cindex -funroll-loops option +@cindex options, -funroll-loops +@item -funroll-loops +@cindex loops, unrolling +@cindex unrolling loops +@cindex loops, optimizing +@cindex indexed (iterative) @code{DO} +@cindex iterative @code{DO} +@c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to +@c provide a suitable term +@c CB: I've decided on `iterative', for the time being, and changed +@c my previous, rather bizarre, use of `imperative' to that +@c (though `precomputed-trip' would be a more precise adjective) +Typically improves performance on code using iterative @code{DO} loops by +unrolling them and is probably generally appropriate for Fortran, though +it is not turned on at any optimization level. +Note that outer loop unrolling isn't done specifically; decisions about +whether to unroll a loop are made on the basis of its instruction count. + +@c DL: Fixme: This should obviously go somewhere else... +Also, no `loop discovery'@footnote{@dfn{loop discovery} refers to the +process by which a compiler, or indeed any reader of a program, +determines which portions of the program are more likely to be executed +repeatedly as it is being run. Such discovery typically is done early +when compiling using optimization techniques, so the ``discovered'' +loops get more attention---and more run-time resources, such as +registers---from the compiler. It is easy to ``discover'' loops that are +constructed out of looping constructs in the language +(such as Fortran's @code{DO}). For some programs, ``discovering'' loops +constructed out of lower-level constructs (such as @code{IF} and +@code{GOTO}) can lead to generation of more optimal code +than otherwise.} is done, so only loops written with @code{DO} +benefit from loop optimizations, including---but not limited +to---unrolling. Loops written with @code{IF} and @code{GOTO} are not +currently recognized as such. This option unrolls only iterative +@code{DO} loops, not @code{DO WHILE} loops. + +@cindex -funroll-all-loops option +@cindex options, -funroll-all-loops +@cindex DO WHILE +@item -funroll-all-loops +@c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct. +Probably improves performance on code using @code{DO WHILE} loops by +unrolling them in addition to iterative @code{DO} loops. In the absence +of @code{DO WHILE}, this option is equivalent to @samp{-funroll-loops} +but possibly slower. + +@item -fno-move-all-movables +@cindex -fno-move-all-movables option +@cindex options, -fno-move-all-movables +@item -fno-reduce-all-givs +@cindex -fno-reduce-all-givs option +@cindex options, -fno-reduce-all-givs +@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 @code{g77} based on @code{gcc} version 2.8. + +Each of these might improve performance on some code. + +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}). + +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 @code{gcc} command-line options. +@end table + +@xref{Optimize Options,,Options That Control Optimization, +gcc,Using and Porting GNU CC}, for more information on options +to optimize the generated machine code. + +@node Preprocessor Options +@section Options Controlling the Preprocessor +@cindex preprocessor options +@cindex options, preprocessor +@cindex cpp program +@cindex programs, cpp + +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. + +@cindex INCLUDE directive +@cindex directive, INCLUDE +Some of these options also affect how @code{g77} processes the +@code{INCLUDE} directive. +Since this directive is processed even when preprocessing +is not requested, it is not described in this section. +@xref{Directory Options,,Options for Directory Search}, for +information on how @code{g77} processes the @code{INCLUDE} directive. + +However, the @code{INCLUDE} directive does not apply +preprocessing to the contents of the included file itself. + +Therefore, any file that contains preprocessor directives +(such as @code{#include}, @code{#define}, and @code{#if}) +must be included via the @code{#include} directive, not +via the @code{INCLUDE} directive. +Therefore, any file containing preprocessor directives, +if included, is necessarily included by a file that itself +contains preprocessor directives. + +@node Directory Options +@section Options for Directory Search +@cindex directory, options +@cindex options, directory search +@cindex search path + +These options affect how the @code{cpp} preprocessor searches +for files specified via the @code{#include} directive. +Therefore, when compiling Fortran programs, they are meaningful +when the preprocessor is used. + +@cindex INCLUDE directive +@cindex directive, INCLUDE +Some of these options also affect how @code{g77} searches +for files specified via the @code{INCLUDE} directive, +although files included by that directive are not, +themselves, preprocessed. +These options are: + +@table @code +@cindex -I- option +@cindex options, -I- +@item -I- +@cindex -Idir option +@cindex options, -Idir +@item -I@var{dir} +@cindex directory, search paths for inclusion +@cindex inclusion, directory search paths for +@cindex search paths, for included files +@cindex paths, search +These affect interpretation of the @code{INCLUDE} directive +(as well as of the @code{#include} directive of the @code{cpp} +preprocessor). + +Note that @samp{-I@var{dir}} must be specified @emph{without} any +spaces between @samp{-I} and the directory name---that is, +@samp{-Ifoo/bar} is valid, but @samp{-I foo/bar} +is rejected by the @code{g77} compiler (though the preprocessor supports +the latter form). +@c this is due to toplev.c's inflexible option processing +Also note that the general behavior of @samp{-I} and +@code{INCLUDE} is pretty much the same as of @samp{-I} with +@code{#include} in the @code{cpp} preprocessor, with regard to +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 @samp{-I} option. +@end table + +@node Code Gen Options +@section Options for Code Generation Conventions +@cindex code generation, conventions +@cindex options, code generation +@cindex run-time, options + +These machine-independent options control the interface conventions +used in code generation. + +Most of them have both positive and negative forms; the negative form +of @samp{-ffoo} would be @samp{-fno-foo}. In the table below, only +one of the forms is listed---the one which is not the default. You +can figure out the other form by either removing @samp{no-} or adding +it. + +@table @code +@cindex -fno-automatic option +@cindex options, -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 @samp{-static}.) + +@cindex -finit-local-zero option +@cindex options, -finit-local-zero +@item -finit-local-zero +@cindex DATA statement +@cindex statements, DATA +@cindex initialization, of local variables +@cindex variables, initialization of +@cindex uninitialized variables +@cindex variables, uninitialized +Specify that variables and arrays that are local to a program unit +(not in a common block and not passed as an argument) are to be initialized +to binary zeros. + +Since there is a run-time penalty for initialization of variables +that are not given the @code{SAVE} attribute, it might be a +good idea to also use @samp{-fno-automatic} with @samp{-finit-local-zero}. + +@cindex -fno-f2c option +@cindex options, -fno-f2c +@item -fno-f2c +@cindex @code{f2c} compatibility +@cindex compatibility, @code{f2c} +Do not generate code designed to be compatible with code generated +by @code{f2c}; use the GNU calling conventions instead. + +The @code{f2c} calling conventions require functions that return +type @code{REAL(KIND=1)} 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 GNU calling conventions, such functions simply return +their results as they would in GNU C---@code{REAL(KIND=1)} functions +return the C type @code{float}, and @code{COMPLEX} functions +return the GNU C type @code{complex} (or its @code{struct} +equivalent). + +This does not affect the generation of code that interfaces with the +@code{libg2c} library. + +However, because the @code{libg2c} library uses @code{f2c} +calling conventions, @code{g77} rejects attempts to pass +intrinsics implemented by routines in this library as actual +arguments when @samp{-fno-f2c} is used, to avoid bugs when +they are actually called by code expecting the GNU calling +conventions to work. + +For example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is +rejected when @samp{-fno-f2c} is in force. +(Future versions of the @code{g77} run-time library might +offer routines that provide GNU-callable versions of the +routines that implement the @code{f2c}-callable intrinsics +that may be passed as actual arguments, so that +valid programs need not be rejected when @samp{-fno-f2c} +is used.) + +@strong{Caution:} If @samp{-fno-f2c} is used when compiling any +source file used in a program, it must be used when compiling +@emph{all} Fortran source files used in that program. + +@c seems kinda dumb to tell people about an option they can't use -- jcb +@c then again, we want users building future-compatible libraries with it. +@cindex -ff2c-library option +@cindex options, -ff2c-library +@item -ff2c-library +Specify that use of @code{libg2c} (or the original @code{libf2c}) +is required. +This is the default for the current version of @code{g77}. + +Currently it is not +valid to specify @samp{-fno-f2c-library}. +This option is provided so users can specify it in shell +scripts that build programs and libraries that require the +@code{libf2c} library, even when being compiled by future +versions of @code{g77} that might otherwise default to +generating code for an incompatible library. + +@cindex -fno-underscoring option +@cindex options, -fno-underscoring +@item -fno-underscoring +@cindex underscore +@cindex symbol names, underscores +@cindex transforming symbol names +@cindex symbol names, transforming +Do not transform names of entities specified in the Fortran +source file by appending underscores to them. + +With @samp{-funderscoring} in effect, @code{g77} appends two underscores +to names with underscores and one underscore to external names with +no underscores. (@code{g77} also appends two underscores to internal +names with underscores to avoid naming collisions with external names. +The @samp{-fno-second-underscore} option disables appending of the +second underscore in all cases.) + +This is done to ensure compatibility with code produced by many +UNIX Fortran compilers, including @code{f2c}, which perform the +same transformations. + +Use of @samp{-fno-underscoring} is not recommended unless you are +experimenting with issues such as integration of (GNU) Fortran into +existing system environments (vis-a-vis existing libraries, tools, and +so on). + +For example, with @samp{-funderscoring}, and assuming other defaults like +@samp{-fcase-lower} and that @samp{j()} and @samp{max_count()} are +external functions while @samp{my_var} and @samp{lvar} are local variables, +a statement like + +@smallexample +I = J() + MAX_COUNT (MY_VAR, LVAR) +@end smallexample + +@noindent +is implemented as something akin to: + +@smallexample +i = j_() + max_count__(&my_var__, &lvar); +@end smallexample + +With @samp{-fno-underscoring}, the same statement is implemented as: + +@smallexample +i = j() + max_count(&my_var, &lvar); +@end smallexample + +Use of @samp{-fno-underscoring} allows direct specification of +user-defined names while debugging and when interfacing @code{g77}-compiled +code with other languages. + +Note that just because the names match does @emph{not} mean that the +interface implemented by @code{g77} for an external name matches the +interface implemented by some other language for that same name. +That is, getting code produced by @code{g77} to link to code produced +by some other compiler using this or any other method can be only a +small part of the overall solution---getting the code generated by +both compilers to agree on issues other than naming can require +significant effort, and, unlike naming disagreements, linkers normally +cannot detect disagreements in these other areas. + +Also, note that with @samp{-fno-underscoring}, the lack of appended +underscores introduces the very real possibility that a user-defined +external name will conflict with a name in a system library, which +could make finding unresolved-reference bugs quite difficult in some +cases---they might occur at program run time, and show up only as +buggy behavior at run time. + +In future versions of @code{g77}, we hope to improve naming and linking +issues so that debugging always involves using the names as they appear +in the source, even if the names as seen by the linker are mangled to +prevent accidental linking between procedures with incompatible +interfaces. + +@cindex -fno-second-underscore option +@cindex options, -fno-second-underscore +@item -fno-second-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. + +This option has no effect if @samp{-fno-underscoring} is +in effect. + +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__}. + +@cindex -fno-ident option +@cindex options, -fno-ident +@item -fno-ident +Ignore the @samp{#ident} directive. + +@cindex -fzeros option +@cindex options, -fzeros +@item -fzeros +Treat initial values of zero as if they were any other value. + +As of version 0.5.18, @code{g77} normally treats @code{DATA} and +other statements that are used to specify initial values of zero +for variables and arrays as if no values were actually specified, +in the sense that no diagnostics regarding multiple initializations +are produced. + +This is done to speed up compiling of programs that initialize +large arrays to zeros. + +Use @samp{-fzeros} to revert to the simpler, slower behavior +that can catch multiple initializations by keeping track of +all initializations, zero or otherwise. + +@emph{Caution:} Future versions of @code{g77} might disregard this option +(and its negative form, the default) or interpret it somewhat +differently. +The interpretation changes will affect only non-standard +programs; standard-conforming programs should not be affected. + +@cindex -femulate-complex option +@cindex options, -femulate-complex +@item -femulate-complex +Implement @code{COMPLEX} arithmetic via emulation, +instead of using the facilities of +the @code{gcc} back end that provide direct support of +@code{complex} arithmetic. + +(@code{gcc} had some bugs in its back-end support +for @code{complex} arithmetic, due primarily to the support not being +completed as of version 2.8.1 and @code{egcs} 1.1.2.) + +Use @samp{-femulate-complex} if you suspect code-generation bugs, +or experience compiler crashes, +that might result from @code{g77} using the @code{COMPLEX} support +in the @code{gcc} back end. +If using that option fixes the bugs or crashes you are seeing, +that indicates a likely @code{g77} bugs +(though, all compiler crashes are considered bugs), +so, please report it. +(Note that the known bugs, now believed fixed, produced compiler crashes +rather than causing the generation of incorrect code.) + +Use of this option should not affect how Fortran code compiled +by @code{g77} works in terms of its interfaces to other code, +e.g. that compiled by @code{f2c}. + +@emph{Caution:} Future versions of @code{g77} might ignore both forms +of this option. + +@cindex -falias-check option +@cindex options, -falias-check +@cindex -fargument-alias option +@cindex options, -fargument-alias +@cindex -fargument-noalias option +@cindex options, -fargument-noalias +@cindex -fno-argument-noalias-global option +@cindex options, -fno-argument-noalias-global +@item -falias-check +@item -fargument-alias +@item -fargument-noalias +@item -fno-argument-noalias-global +@emph{Version info:} +These options are not supported by +versions of @code{g77} based on @code{gcc} version 2.8. + +These options specify to what degree aliasing +(overlap) +is permitted between +arguments (passed as pointers) and @code{COMMON} (external, or +public) storage. + +The default for Fortran code, as mandated by the FORTRAN 77 and +Fortran 90 standards, is @samp{-fargument-noalias-global}. +The default for code written in the C language family is +@samp{-fargument-alias}. + +Note that, on some systems, compiling with @samp{-fforce-addr} in +effect can produce more optimal code when the default aliasing +options are in effect (and when optimization is enabled). + +@xref{Aliasing Assumed To Work}, for detailed information on the implications +of compiling Fortran code that depends on the ability to alias dummy +arguments. + +@cindex -fno-globals option +@cindex options, -fno-globals +@item -fno-globals +@cindex global names, warning +@cindex warnings, global names +@cindex in-line code +@cindex compilation, in-line +Disable diagnostics about inter-procedural +analysis problems, such as disagreements about the +type of a function or a procedure's argument, +that might cause a compiler crash when attempting +to inline a reference to a procedure within a +program unit. +(The diagnostics themselves are still produced, but +as warnings, unless @samp{-Wno-globals} is specified, +in which case no relevant diagnostics are produced.) + +Further, this option disables such inlining, to +avoid compiler crashes resulting from incorrect +code that would otherwise be diagnosed. + +As such, this option might be quite useful when +compiling existing, ``working'' code that happens +to have a few bugs that do not generally show themselves, +but which @code{g77} diagnoses. + +Use of this option therefore has the effect of +instructing @code{g77} to behave more like it did +up through version 0.5.19.1, when it paid little or +no attention to disagreements between program units +about a procedure's type and argument information, +and when it performed no inlining of procedures +(except statement functions). + +Without this option, @code{g77} defaults to performing +the potentially inlining procedures as it started doing +in version 0.5.20, but as of version 0.5.21, it also +diagnoses disagreements that might cause such inlining +to crash the compiler as (fatal) errors, +and warns about similar disagreements +that are currently believed to not +likely to result in the compiler later crashing +or producing incorrect code. + +@cindex -fflatten-arrays option +@item -fflatten-arrays +@cindex array performance +@cindex arrays, flattening +Use back end's C-like constructs +(pointer plus offset) +instead of its @code{ARRAY_REF} construct +to handle all array references. + +@emph{Note:} This option is not supported. +It is intended for use only by @code{g77} developers, +to evaluate code-generation issues. +It might be removed at any time. + +@cindex -fbounds-check option +@cindex -ffortran-bounds-check option +@item -fbounds-check +@itemx -ffortran-bounds-check +@cindex bounds checking +@cindex range checking +@cindex array bounds checking +@cindex subscript checking +@cindex substring checking +@cindex checking subscripts +@cindex checking substrings +Enable generation of run-time checks for array subscripts +and substring start and end points +against the (locally) declared minimum and maximum values. + +The current implementation uses the @code{libf2c} +library routine @code{s_rnge} to print the diagnostic. + +However, whereas @code{f2c} generates a single check per +reference for a multi-dimensional array, of the computed +offset against the valid offset range (0 through the size of the array), +@code{g77} generates a single check per @emph{subscript} expression. +This catches some cases of potential bugs that @code{f2c} does not, +such as references to below the beginning of an assumed-size array. + +@code{g77} also generates checks for @code{CHARACTER} substring references, +something @code{f2c} currently does not do. + +Use the new @samp{-ffortran-bounds-check} option +to specify bounds-checking for only the Fortran code you are compiling, +not necessarily for code written in other languages. + +@emph{Note:} To provide more detailed information on the offending subscript, +@code{g77} provides the @code{libg2c} run-time library routine @code{s_rnge} +with somewhat differently-formatted information. +Here's a sample diagnostic: + +@smallexample +Subscript out of range on file line 4, procedure rnge.f/bf. +Attempt to access the -6-th element of variable b[subscript-2-of-2]. +Aborted +@end smallexample + +The above message indicates that the offending source line is +line 4 of the file @file{rnge.f}, +within the program unit (or statement function) named @samp{bf}. +The offended array is named @samp{b}. +The offended array dimension is the second for a two-dimensional array, +and the offending, computed subscript expression was @samp{-6}. + +For a @code{CHARACTER} substring reference, the second line has +this appearance: + +@smallexample +Attempt to access the 11-th element of variable a[start-substring]. +@end smallexample + +This indicates that the offended @code{CHARACTER} variable or array +is named @samp{a}, +the offended substring position is the starting (leftmost) position, +and the offending substring expression is @samp{11}. + +(Though the verbage of @code{s_rnge} is not ideal +for the purpose of the @code{g77} compiler, +the above information should provide adequate diagnostic abilities +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 +offered by the GBE +shared by @code{g77}, @code{gcc}, and other GNU compilers. + +Some of these do @emph{not} work when compiling programs written in Fortran: + +@table @code +@cindex -fpcc-struct-return option +@cindex options, -fpcc-struct-return +@item -fpcc-struct-return +@cindex -freg-struct-return option +@cindex options, -freg-struct-return +@item -freg-struct-return +You should not use these except strictly the same way as you +used them to build the version of @code{libg2c} with which +you will be linking all code compiled by @code{g77} with the +same option. + +@cindex -fshort-double option +@cindex options, -fshort-double +@item -fshort-double +This probably either has no effect on Fortran programs, or +makes them act loopy. + +@cindex -fno-common option +@cindex options, -fno-common +@item -fno-common +Do not use this when compiling Fortran programs, +or there will be Trouble. + +@cindex -fpack-struct option +@cindex options, -fpack-struct +@item -fpack-struct +This probably will break any calls to the @code{libg2c} library, +at the very least, even if it is built with the same option. +@end table + +@node Environment Variables +@section Environment Variables Affecting GNU Fortran +@cindex environment variables + +GNU Fortran currently does not make use of any environment +variables to control its operation above and beyond those +that affect the operation of @code{gcc}. + +@xref{Environment Variables,,Environment Variables Affecting GNU CC, +gcc,Using and Porting GNU CC}, for information on environment +variables. |