xref: /openbsd/gnu/usr.bin/gcc/gcc/f/invoke.texi (revision 4e43c760)
1*4e43c760Sespie@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
2c87b03e5Sespie@c Free Software Foundation, Inc.
3c87b03e5Sespie@c This is part of the G77 manual.
4c87b03e5Sespie@c For copying conditions, see the file g77.texi.
5c87b03e5Sespie
6c87b03e5Sespie@ignore
7c87b03e5Sespie@c man begin COPYRIGHT
8*4e43c760SespieCopyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
9c87b03e5SespieFree Software Foundation, Inc.
10c87b03e5Sespie
11c87b03e5SespiePermission is granted to copy, distribute and/or modify this document
12c87b03e5Sespieunder the terms of the GNU Free Documentation License, Version 1.2 or
13c87b03e5Sespieany later version published by the Free Software Foundation; with the
14c87b03e5SespieInvariant Sections being ``GNU General Public License'' and ``Funding
15c87b03e5SespieFree Software'', the Front-Cover texts being (a) (see below), and with
16c87b03e5Sespiethe Back-Cover Texts being (b) (see below).  A copy of the license is
17c87b03e5Sespieincluded in the gfdl(7) man page.
18c87b03e5Sespie
19c87b03e5Sespie(a) The FSF's Front-Cover Text is:
20c87b03e5Sespie
21c87b03e5Sespie     A GNU Manual
22c87b03e5Sespie
23c87b03e5Sespie(b) The FSF's Back-Cover Text is:
24c87b03e5Sespie
25c87b03e5Sespie     You have freedom to copy and modify this GNU Manual, like GNU
26c87b03e5Sespie     software.  Copies published by the Free Software Foundation raise
27c87b03e5Sespie     funds for GNU development.
28c87b03e5Sespie@c man end
29c87b03e5Sespie@c Set file name and title for the man page.
30c87b03e5Sespie@setfilename g77
31c87b03e5Sespie@settitle GNU project Fortran 77 compiler.
32c87b03e5Sespie@c man begin SYNOPSIS
33c87b03e5Sespieg77 [@option{-c}|@option{-S}|@option{-E}]
34c87b03e5Sespie    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35c87b03e5Sespie    [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36c87b03e5Sespie    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37c87b03e5Sespie    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38c87b03e5Sespie    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39c87b03e5Sespie    [@option{-o} @var{outfile}] @var{infile}@dots{}
40c87b03e5Sespie
41c87b03e5SespieOnly the most useful options are listed here; see below for the
42c87b03e5Sespieremainder.
43c87b03e5Sespie@c man end
44c87b03e5Sespie@c man begin SEEALSO
45c87b03e5Sespiegpl(7), gfdl(7), fsf-funding(7),
46c87b03e5Sespiecpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47c87b03e5Sespieand the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
48c87b03e5Sespie@file{ld}, @file{binutils} and @file{gdb}.
49c87b03e5Sespie@c man end
50c87b03e5Sespie@c man begin BUGS
51c87b03e5SespieFor instructions on reporting bugs, see
52c87b03e5Sespie@w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53c87b03e5Sespiescript to report bugs is recommended.
54c87b03e5Sespie@c man end
55c87b03e5Sespie@c man begin AUTHOR
56c87b03e5SespieSee the Info entry for @command{g77} for contributors to GCC and G77@.
57c87b03e5Sespie@c man end
58c87b03e5Sespie@end ignore
59c87b03e5Sespie
60c87b03e5Sespie@node Invoking G77
61c87b03e5Sespie@chapter GNU Fortran Command Options
62c87b03e5Sespie@cindex GNU Fortran command options
63c87b03e5Sespie@cindex command options
64c87b03e5Sespie@cindex options, GNU Fortran command
65c87b03e5Sespie
66c87b03e5Sespie@c man begin DESCRIPTION
67c87b03e5Sespie
68c87b03e5SespieThe @command{g77} command supports all the options supported by the
69c87b03e5Sespie@command{gcc} command.
70c87b03e5Sespie@xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
71c87b03e5SespieCollection (GCC)}, for information
72c87b03e5Sespieon the non-Fortran-specific aspects of the @command{gcc} command (and,
73c87b03e5Sespietherefore, the @command{g77} command).
74c87b03e5Sespie
75c87b03e5Sespie@cindex options, negative forms
76c87b03e5Sespie@cindex negative forms of options
77c87b03e5SespieAll @command{gcc} and @command{g77} options
78c87b03e5Sespieare accepted both by @command{g77} and by @command{gcc}
79c87b03e5Sespie(as well as any other drivers built at the same time,
80c87b03e5Sespiesuch as @command{g++}),
81c87b03e5Sespiesince adding @command{g77} to the @command{gcc} distribution
82c87b03e5Sespieenables acceptance of @command{g77} options
83c87b03e5Sespieby all of the relevant drivers.
84c87b03e5Sespie
85c87b03e5SespieIn some cases, options have positive and negative forms;
86c87b03e5Sespiethe negative form of @option{-ffoo} would be @option{-fno-foo}.
87c87b03e5SespieThis manual documents only one of these two forms, whichever
88c87b03e5Sespieone is not the default.
89c87b03e5Sespie
90c87b03e5Sespie@c man end
91c87b03e5Sespie
92c87b03e5Sespie@menu
93c87b03e5Sespie* Option Summary::      Brief list of all @command{g77} options,
94c87b03e5Sespie                        without explanations.
95c87b03e5Sespie* Overall Options::     Controlling the kind of output:
96c87b03e5Sespie                        an executable, object files, assembler files,
97c87b03e5Sespie                        or preprocessed source.
98c87b03e5Sespie* Shorthand Options::   Options that are shorthand for other options.
99c87b03e5Sespie* Fortran Dialect Options::  Controlling the variant of Fortran language
100c87b03e5Sespie                             compiled.
101c87b03e5Sespie* Warning Options::     How picky should the compiler be?
102c87b03e5Sespie* Debugging Options::   Symbol tables, measurements, and debugging dumps.
103c87b03e5Sespie* Optimize Options::    How much optimization?
104c87b03e5Sespie* Preprocessor Options:: Controlling header files and macro definitions.
105c87b03e5Sespie                         Also, getting dependency information for Make.
106c87b03e5Sespie* Directory Options::   Where to find header files and libraries.
107c87b03e5Sespie                        Where to find the compiler executable files.
108c87b03e5Sespie* Code Gen Options::    Specifying conventions for function calls, data layout
109c87b03e5Sespie                        and register usage.
110c87b03e5Sespie* Environment Variables:: Env vars that affect GNU Fortran.
111c87b03e5Sespie@end menu
112c87b03e5Sespie
113c87b03e5Sespie@node Option Summary
114c87b03e5Sespie@section Option Summary
115c87b03e5Sespie
116c87b03e5Sespie@c man begin OPTIONS
117c87b03e5Sespie
118c87b03e5SespieHere is a summary of all the options specific to GNU Fortran, grouped
119c87b03e5Sespieby type.  Explanations are in the following sections.
120c87b03e5Sespie
121c87b03e5Sespie@table @emph
122c87b03e5Sespie@item Overall Options
123c87b03e5Sespie@xref{Overall Options,,Options Controlling the Kind of Output}.
124c87b03e5Sespie@gccoptlist{
125c87b03e5Sespie-fversion  -fset-g77-defaults  -fno-silent}
126c87b03e5Sespie
127c87b03e5Sespie@item Shorthand Options
128c87b03e5Sespie@xref{Shorthand Options}.
129c87b03e5Sespie@gccoptlist{
130c87b03e5Sespie-ff66  -fno-f66  -ff77  -fno-f77  -fno-ugly}
131c87b03e5Sespie
132c87b03e5Sespie@item Fortran Language Options
133c87b03e5Sespie@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
134c87b03e5Sespie@gccoptlist{
135c87b03e5Sespie-ffree-form  -fno-fixed-form  -ff90 @gol
136c87b03e5Sespie-fvxt  -fdollar-ok  -fno-backslash @gol
137c87b03e5Sespie-fno-ugly-args  -fno-ugly-assign  -fno-ugly-assumed @gol
138c87b03e5Sespie-fugly-comma  -fugly-complex  -fugly-init  -fugly-logint @gol
139c87b03e5Sespie-fonetrip  -ftypeless-boz @gol
140c87b03e5Sespie-fintrin-case-initcap  -fintrin-case-upper @gol
141c87b03e5Sespie-fintrin-case-lower  -fintrin-case-any @gol
142c87b03e5Sespie-fmatch-case-initcap  -fmatch-case-upper @gol
143c87b03e5Sespie-fmatch-case-lower  -fmatch-case-any @gol
144c87b03e5Sespie-fsource-case-upper  -fsource-case-lower @gol
145c87b03e5Sespie-fsource-case-preserve @gol
146c87b03e5Sespie-fsymbol-case-initcap  -fsymbol-case-upper @gol
147c87b03e5Sespie-fsymbol-case-lower  -fsymbol-case-any @gol
148c87b03e5Sespie-fcase-strict-upper  -fcase-strict-lower @gol
149c87b03e5Sespie-fcase-initcap  -fcase-upper  -fcase-lower  -fcase-preserve @gol
150c87b03e5Sespie-ff2c-intrinsics-delete  -ff2c-intrinsics-hide @gol
151c87b03e5Sespie-ff2c-intrinsics-disable  -ff2c-intrinsics-enable @gol
152c87b03e5Sespie-fbadu77-intrinsics-delete  -fbadu77-intrinsics-hide @gol
153c87b03e5Sespie-fbadu77-intrinsics-disable  -fbadu77-intrinsics-enable @gol
154c87b03e5Sespie-ff90-intrinsics-delete  -ff90-intrinsics-hide @gol
155c87b03e5Sespie-ff90-intrinsics-disable  -ff90-intrinsics-enable @gol
156c87b03e5Sespie-fgnu-intrinsics-delete  -fgnu-intrinsics-hide @gol
157c87b03e5Sespie-fgnu-intrinsics-disable  -fgnu-intrinsics-enable @gol
158c87b03e5Sespie-fmil-intrinsics-delete  -fmil-intrinsics-hide @gol
159c87b03e5Sespie-fmil-intrinsics-disable  -fmil-intrinsics-enable @gol
160c87b03e5Sespie-funix-intrinsics-delete  -funix-intrinsics-hide @gol
161c87b03e5Sespie-funix-intrinsics-disable  -funix-intrinsics-enable @gol
162c87b03e5Sespie-fvxt-intrinsics-delete  -fvxt-intrinsics-hide @gol
163c87b03e5Sespie-fvxt-intrinsics-disable  -fvxt-intrinsics-enable @gol
164c87b03e5Sespie-ffixed-line-length-@var{n}  -ffixed-line-length-none}
165c87b03e5Sespie
166c87b03e5Sespie@item Warning Options
167c87b03e5Sespie@xref{Warning Options,,Options to Request or Suppress Warnings}.
168c87b03e5Sespie@gccoptlist{
169c87b03e5Sespie-fsyntax-only  -pedantic  -pedantic-errors  -fpedantic @gol
170c87b03e5Sespie-w  -Wno-globals  -Wimplicit  -Wunused  -Wuninitialized @gol
171c87b03e5Sespie-Wall  -Wsurprising @gol
172c87b03e5Sespie-Werror  -W}
173c87b03e5Sespie
174c87b03e5Sespie@item Debugging Options
175c87b03e5Sespie@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
176c87b03e5Sespie@gccoptlist{
177c87b03e5Sespie-g}
178c87b03e5Sespie
179c87b03e5Sespie@item Optimization Options
180c87b03e5Sespie@xref{Optimize Options,,Options that Control Optimization}.
181c87b03e5Sespie@gccoptlist{
182c87b03e5Sespie-malign-double @gol
183c87b03e5Sespie-ffloat-store  -fforce-mem  -fforce-addr  -fno-inline @gol
184c87b03e5Sespie-ffast-math  -fstrength-reduce  -frerun-cse-after-loop @gol
185c87b03e5Sespie-funsafe-math-optimizations -ffinite-math-only -fno-trapping-math @gol
186c87b03e5Sespie-fexpensive-optimizations  -fdelayed-branch @gol
187c87b03e5Sespie-fschedule-insns  -fschedule-insn2  -fcaller-saves @gol
188c87b03e5Sespie-funroll-loops  -funroll-all-loops @gol
189c87b03e5Sespie-fno-move-all-movables  -fno-reduce-all-givs @gol
190c87b03e5Sespie-fno-rerun-loop-opt}
191c87b03e5Sespie
192c87b03e5Sespie@item Directory Options
193c87b03e5Sespie@xref{Directory Options,,Options for Directory Search}.
194c87b03e5Sespie@gccoptlist{
195c87b03e5Sespie-I@var{dir}  -I-}
196c87b03e5Sespie
197c87b03e5Sespie@item Code Generation Options
198c87b03e5Sespie@xref{Code Gen Options,,Options for Code Generation Conventions}.
199c87b03e5Sespie@gccoptlist{
200c87b03e5Sespie-fno-automatic  -finit-local-zero  -fno-f2c @gol
201c87b03e5Sespie-ff2c-library  -fno-underscoring  -fno-ident @gol
202c87b03e5Sespie-fpcc-struct-return  -freg-struct-return @gol
203c87b03e5Sespie-fshort-double  -fno-common  -fpack-struct @gol
204c87b03e5Sespie-fzeros  -fno-second-underscore @gol
205c87b03e5Sespie-femulate-complex @gol
206c87b03e5Sespie-falias-check  -fargument-alias @gol
207c87b03e5Sespie-fargument-noalias  -fno-argument-noalias-global @gol
208c87b03e5Sespie-fno-globals  -fflatten-arrays @gol
209c87b03e5Sespie-fbounds-check  -ffortran-bounds-check}
210c87b03e5Sespie@end table
211c87b03e5Sespie
212c87b03e5Sespie@c man end
213c87b03e5Sespie
214c87b03e5Sespie@menu
215c87b03e5Sespie* Overall Options::     Controlling the kind of output:
216c87b03e5Sespie                        an executable, object files, assembler files,
217c87b03e5Sespie                        or preprocessed source.
218c87b03e5Sespie* Shorthand Options::   Options that are shorthand for other options.
219c87b03e5Sespie* Fortran Dialect Options::  Controlling the variant of Fortran language
220c87b03e5Sespie                             compiled.
221c87b03e5Sespie* Warning Options::     How picky should the compiler be?
222c87b03e5Sespie* Debugging Options::   Symbol tables, measurements, and debugging dumps.
223c87b03e5Sespie* Optimize Options::    How much optimization?
224c87b03e5Sespie* Preprocessor Options:: Controlling header files and macro definitions.
225c87b03e5Sespie                         Also, getting dependency information for Make.
226c87b03e5Sespie* Directory Options::   Where to find header files and libraries.
227c87b03e5Sespie                        Where to find the compiler executable files.
228c87b03e5Sespie* Code Gen Options::    Specifying conventions for function calls, data layout
229c87b03e5Sespie                        and register usage.
230c87b03e5Sespie@end menu
231c87b03e5Sespie
232c87b03e5Sespie@node Overall Options
233c87b03e5Sespie@section Options Controlling the Kind of Output
234c87b03e5Sespie@cindex overall options
235c87b03e5Sespie@cindex options, overall
236c87b03e5Sespie
237c87b03e5Sespie@c man begin OPTIONS
238c87b03e5Sespie
239c87b03e5SespieCompilation can involve as many as four stages: preprocessing, code
240c87b03e5Sespiegeneration (often what is really meant by the term ``compilation''),
241c87b03e5Sespieassembly, and linking, always in that order.  The first three
242c87b03e5Sespiestages apply to an individual source file, and end by producing an
243c87b03e5Sespieobject file; linking combines all the object files (those newly
244c87b03e5Sespiecompiled, and those specified as input) into an executable file.
245c87b03e5Sespie
246c87b03e5Sespie@cindex file name suffix
247c87b03e5Sespie@cindex suffixes, file name
248c87b03e5Sespie@cindex file name extension
249c87b03e5Sespie@cindex extensions, file name
250c87b03e5Sespie@cindex file type
251c87b03e5Sespie@cindex types, file
252c87b03e5SespieFor any given input file, the file name suffix determines what kind of
253c87b03e5Sespieprogram is contained in the file---that is, the language in which the
254c87b03e5Sespieprogram is written is generally indicated by the suffix.
255c87b03e5SespieSuffixes specific to GNU Fortran are listed below.
256c87b03e5Sespie@xref{Overall Options,,Options Controlling the Kind of
257c87b03e5SespieOutput,gcc,Using the GNU Compiler Collection (GCC)}, for
258c87b03e5Sespieinformation on suffixes recognized by GNU CC.
259c87b03e5Sespie
260c87b03e5Sespie@table @gcctabopt
261c87b03e5Sespie@cindex .f filename suffix
262c87b03e5Sespie@cindex .for filename suffix
263c87b03e5Sespie@cindex .FOR filename suffix
264c87b03e5Sespie@item @var{file}.f
265c87b03e5Sespie@item @var{file}.for
266c87b03e5Sespie@item @var{file}.FOR
267c87b03e5SespieFortran source code that should not be preprocessed.
268c87b03e5Sespie
269c87b03e5SespieSuch source code cannot contain any preprocessor directives, such
270c87b03e5Sespieas @code{#include}, @code{#define}, @code{#if}, and so on.
271c87b03e5Sespie
272c87b03e5SespieYou can force @samp{.f} files to be preprocessed by @command{cpp} by using
273c87b03e5Sespie@option{-x f77-cpp-input}.
274c87b03e5Sespie@xref{LEX}.
275c87b03e5Sespie
276c87b03e5Sespie@cindex preprocessor
277c87b03e5Sespie@cindex C preprocessor
278c87b03e5Sespie@cindex cpp preprocessor
279c87b03e5Sespie@cindex Fortran preprocessor
280c87b03e5Sespie@cindex cpp program
281c87b03e5Sespie@cindex programs, cpp
282c87b03e5Sespie@cindex .F filename suffix
283c87b03e5Sespie@cindex .fpp filename suffix
284c87b03e5Sespie@cindex .FPP filename suffix
285c87b03e5Sespie@item @var{file}.F
286c87b03e5Sespie@item @var{file}.fpp
287c87b03e5Sespie@item @var{file}.FPP
288c87b03e5SespieFortran source code that must be preprocessed (by the C preprocessor
289c87b03e5Sespie@command{cpp}, which is part of GNU CC).
290c87b03e5Sespie
291c87b03e5SespieNote that preprocessing is not extended to the contents of
292c87b03e5Sespiefiles included by the @code{INCLUDE} directive---the @code{#include}
293c87b03e5Sespiepreprocessor directive must be used instead.
294c87b03e5Sespie
295c87b03e5Sespie@cindex Ratfor preprocessor
296c87b03e5Sespie@cindex programs, @command{ratfor}
297c87b03e5Sespie@cindex @samp{.r} filename suffix
298c87b03e5Sespie@cindex @command{ratfor}
299c87b03e5Sespie@item @var{file}.r
300c87b03e5SespieRatfor source code, which must be preprocessed by the @command{ratfor}
301c87b03e5Sespiecommand, which is available separately (as it is not yet part of the GNU
302c87b03e5SespieFortran distribution).
303*4e43c760SespieA public domain version in C is at
304c87b03e5Sespie@uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}.
305c87b03e5Sespie@end table
306c87b03e5Sespie
307c87b03e5SespieUNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F}
308c87b03e5Sespienomenclature.
309c87b03e5SespieUsers of other operating systems, especially those that cannot
310c87b03e5Sespiedistinguish upper-case
311c87b03e5Sespieletters from lower-case letters in their file names, typically use
312c87b03e5Sespiethe @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature.
313c87b03e5Sespie
314c87b03e5Sespie@cindex #define
315c87b03e5Sespie@cindex #include
316c87b03e5Sespie@cindex #if
317c87b03e5SespieUse of the preprocessor @command{cpp} allows use of C-like
318c87b03e5Sespieconstructs such as @code{#define} and @code{#include}, but can
319c87b03e5Sespielead to unexpected, even mistaken, results due to Fortran's source file
320c87b03e5Sespieformat.
321c87b03e5SespieIt is recommended that use of the C preprocessor
322c87b03e5Sespiebe limited to @code{#include} and, in
323c87b03e5Sespieconjunction with @code{#define}, only @code{#if} and related directives,
324c87b03e5Sespiethus avoiding in-line macro expansion entirely.
325c87b03e5SespieThis recommendation applies especially
326c87b03e5Sespiewhen using the traditional fixed source form.
327c87b03e5SespieWith free source form,
328c87b03e5Sespiefewer unexpected transformations are likely to happen, but use of
329c87b03e5Sespieconstructs such as Hollerith and character constants can nevertheless
330c87b03e5Sespiepresent problems, especially when these are continued across multiple
331c87b03e5Sespiesource lines.
332c87b03e5SespieThese problems result, primarily, from differences between the way
333c87b03e5Sespiesuch constants are interpreted by the C preprocessor and by a Fortran
334c87b03e5Sespiecompiler.
335c87b03e5Sespie
336c87b03e5SespieAnother example of a problem that results from using the C preprocessor
337c87b03e5Sespieis that a Fortran comment line that happens to contain any
338c87b03e5Sespiecharacters ``interesting'' to the C preprocessor,
339c87b03e5Sespiesuch as a backslash at the end of the line,
340c87b03e5Sespieis not recognized by the preprocessor as a comment line,
341c87b03e5Sespieso instead of being passed through ``raw'',
342c87b03e5Sespiethe line is edited according to the rules for the preprocessor.
343c87b03e5SespieFor example, the backslash at the end of the line is removed,
344c87b03e5Sespiealong with the subsequent newline, resulting in the next
345c87b03e5Sespieline being effectively commented out---unfortunate if that
346c87b03e5Sespieline is a non-comment line of important code!
347c87b03e5Sespie
348c87b03e5Sespie@emph{Note:} The @option{-traditional} and @option{-undef} flags are supplied
349c87b03e5Sespieto @command{cpp} by default, to help avoid unpleasant surprises.
350c87b03e5Sespie@xref{Preprocessor Options,,Options Controlling the Preprocessor,
351c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}.
352c87b03e5SespieThis means that ANSI C preprocessor features (such as the @samp{#}
353c87b03e5Sespieoperator) aren't available, and only variables in the C reserved
354c87b03e5Sespienamespace (generally, names with a leading underscore) are liable to
355c87b03e5Sespiesubstitution by C predefines.
356c87b03e5SespieThus, if you want to do system-specific
357c87b03e5Sespietests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}.
358c87b03e5SespieUse the @option{-v} option to see exactly how the preprocessor is invoked.
359c87b03e5Sespie
360c87b03e5Sespie@cindex /*
361c87b03e5SespieUnfortunately, the @option{-traditional} flag will not avoid an error from
362c87b03e5Sespieanything that @command{cpp} sees as an unterminated C comment, such as:
363c87b03e5Sespie@smallexample
364c87b03e5SespieC Some Fortran compilers accept /* as starting
365c87b03e5SespieC an inline comment.
366c87b03e5Sespie@end smallexample
367c87b03e5Sespie@xref{Trailing Comment}.
368c87b03e5Sespie
369c87b03e5SespieThe following options that affect overall processing are recognized
370c87b03e5Sespieby the @command{g77} and @command{gcc} commands in a GNU Fortran installation:
371c87b03e5Sespie
372c87b03e5Sespie@table @gcctabopt
373c87b03e5Sespie@cindex -fversion option
374c87b03e5Sespie@cindex options, -fversion
375c87b03e5Sespie@cindex printing version information
376c87b03e5Sespie@cindex version information, printing
377c87b03e5Sespie@cindex consistency checks
378c87b03e5Sespie@cindex internal consistency checks
379c87b03e5Sespie@cindex checks, of internal consistency
380c87b03e5Sespie@item -fversion
381c87b03e5SespieEnsure that the @command{g77} version of the compiler phase is reported,
382c87b03e5Sespieif run,
383c87b03e5Sespieand, starting in @code{egcs} version 1.1,
384c87b03e5Sespiethat internal consistency checks in the @file{f771} program are run.
385c87b03e5Sespie
386c87b03e5SespieThis option is supplied automatically when @option{-v} or @option{--verbose}
387c87b03e5Sespieis specified as a command-line option for @command{g77} or @command{gcc}
388c87b03e5Sespieand when the resulting commands compile Fortran source files.
389c87b03e5Sespie
390c87b03e5SespieIn GCC 3.1, this is changed back to the behavior @command{gcc} displays
391c87b03e5Sespiefor @samp{.c} files.
392c87b03e5Sespie
393c87b03e5Sespie@cindex -fset-g77-defaults option
394c87b03e5Sespie@cindex options, -fset-g77-defaults
395c87b03e5Sespie@item -fset-g77-defaults
396c87b03e5Sespie@emph{Version info:}
397c87b03e5SespieThis option was obsolete as of @code{egcs}
398c87b03e5Sespieversion 1.1.
399c87b03e5SespieThe effect is instead achieved
400c87b03e5Sespieby the @code{lang_init_options} routine
401c87b03e5Sespiein @file{gcc/gcc/f/com.c}.
402c87b03e5Sespie
403c87b03e5Sespie@cindex consistency checks
404c87b03e5Sespie@cindex internal consistency checks
405c87b03e5Sespie@cindex checks, of internal consistency
406c87b03e5SespieSet up whatever @command{gcc} options are to apply to Fortran
407c87b03e5Sespiecompilations, and avoid running internal consistency checks
408c87b03e5Sespiethat might take some time.
409c87b03e5Sespie
410c87b03e5SespieThis option is supplied automatically when compiling Fortran code
411c87b03e5Sespievia the @command{g77} or @command{gcc} command.
412c87b03e5SespieThe description of this option is provided so that users seeing
413c87b03e5Sespieit in the output of, say, @samp{g77 -v} understand why it is
414c87b03e5Sespiethere.
415c87b03e5Sespie
416c87b03e5Sespie@cindex modifying @command{g77}
417c87b03e5Sespie@cindex @command{g77}, modifying
418c87b03e5SespieAlso, developers who run @code{f771} directly might want to specify it
419c87b03e5Sespieby hand to get the same defaults as they would running @code{f771}
420c87b03e5Sespievia @command{g77} or @command{gcc}
421c87b03e5SespieHowever, such developers should, after linking a new @code{f771}
422c87b03e5Sespieexecutable, invoke it without this option once,
423c87b03e5Sespiee.g. via @kbd{./f771 -quiet < /dev/null},
424c87b03e5Sespieto ensure that they have not introduced any
425c87b03e5Sespieinternal inconsistencies (such as in the table of
426c87b03e5Sespieintrinsics) before proceeding---@command{g77} will crash
427c87b03e5Sespiewith a diagnostic if it detects an inconsistency.
428c87b03e5Sespie
429c87b03e5Sespie@cindex -fno-silent option
430c87b03e5Sespie@cindex options, -fno-silent
431c87b03e5Sespie@cindex f2c compatibility
432c87b03e5Sespie@cindex compatibility, f2c
433c87b03e5Sespie@cindex status, compilation
434c87b03e5Sespie@cindex compilation, status
435c87b03e5Sespie@cindex reporting compilation status
436c87b03e5Sespie@cindex printing compilation status
437c87b03e5Sespie@item -fno-silent
438c87b03e5SespiePrint (to @code{stderr}) the names of the program units as
439c87b03e5Sespiethey are compiled, in a form similar to that used by popular
440c87b03e5SespieUNIX @command{f77} implementations and @command{f2c}
441c87b03e5Sespie@end table
442c87b03e5Sespie
443c87b03e5Sespie@xref{Overall Options,,Options Controlling the Kind of Output,
444c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information
445c87b03e5Sespieon more options that control the overall operation of the @command{gcc} command
446c87b03e5Sespie(and, by extension, the @command{g77} command).
447c87b03e5Sespie
448c87b03e5Sespie@node Shorthand Options
449c87b03e5Sespie@section Shorthand Options
450c87b03e5Sespie@cindex shorthand options
451c87b03e5Sespie@cindex options, shorthand
452c87b03e5Sespie@cindex macro options
453c87b03e5Sespie@cindex options, macro
454c87b03e5Sespie
455c87b03e5SespieThe following options serve as ``shorthand''
456c87b03e5Sespiefor other options accepted by the compiler:
457c87b03e5Sespie
458c87b03e5Sespie@table @gcctabopt
459c87b03e5Sespie@cindex -fugly option
460c87b03e5Sespie@cindex options, -fugly
461c87b03e5Sespie@item -fugly
462c87b03e5Sespie@cindex ugly features
463c87b03e5Sespie@cindex features, ugly
464c87b03e5Sespie@emph{Note:} This option is no longer supported.
465c87b03e5SespieThe information, below, is provided to aid
466c87b03e5Sespiein the conversion of old scripts.
467c87b03e5Sespie
468c87b03e5SespieSpecify that certain ``ugly'' constructs are to be quietly accepted.
469c87b03e5SespieSame as:
470c87b03e5Sespie
471c87b03e5Sespie@smallexample
472c87b03e5Sespie-fugly-args -fugly-assign -fugly-assumed
473c87b03e5Sespie-fugly-comma -fugly-complex -fugly-init
474c87b03e5Sespie-fugly-logint
475c87b03e5Sespie@end smallexample
476c87b03e5Sespie
477c87b03e5SespieThese constructs are considered inappropriate to use in new
478c87b03e5Sespieor well-maintained portable Fortran code, but widely used
479c87b03e5Sespiein old code.
480c87b03e5Sespie@xref{Distensions}, for more information.
481c87b03e5Sespie
482c87b03e5Sespie@cindex -fno-ugly option
483c87b03e5Sespie@cindex options, -fno-ugly
484c87b03e5Sespie@item -fno-ugly
485c87b03e5Sespie@cindex ugly features
486c87b03e5Sespie@cindex features, ugly
487c87b03e5SespieSpecify that all ``ugly'' constructs are to be noisily rejected.
488c87b03e5SespieSame as:
489c87b03e5Sespie
490c87b03e5Sespie@smallexample
491c87b03e5Sespie-fno-ugly-args -fno-ugly-assign -fno-ugly-assumed
492c87b03e5Sespie-fno-ugly-comma -fno-ugly-complex -fno-ugly-init
493c87b03e5Sespie-fno-ugly-logint
494c87b03e5Sespie@end smallexample
495c87b03e5Sespie
496c87b03e5Sespie@xref{Distensions}, for more information.
497c87b03e5Sespie
498c87b03e5Sespie@cindex -ff66 option
499c87b03e5Sespie@cindex options, -ff66
500c87b03e5Sespie@item -ff66
501c87b03e5Sespie@cindex FORTRAN 66
502c87b03e5Sespie@cindex compatibility, FORTRAN 66
503c87b03e5SespieSpecify that the program is written in idiomatic FORTRAN 66.
504c87b03e5SespieSame as @samp{-fonetrip -fugly-assumed}.
505c87b03e5Sespie
506c87b03e5SespieThe @option{-fno-f66} option is the inverse of @option{-ff66}.
507c87b03e5SespieAs such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}.
508c87b03e5Sespie
509c87b03e5SespieThe meaning of this option is likely to be refined as future
510c87b03e5Sespieversions of @command{g77} provide more compatibility with other
511c87b03e5Sespieexisting and obsolete Fortran implementations.
512c87b03e5Sespie
513c87b03e5Sespie@cindex -ff77 option
514c87b03e5Sespie@cindex options, -ff77
515c87b03e5Sespie@item -ff77
516c87b03e5Sespie@cindex UNIX f77
517c87b03e5Sespie@cindex f2c compatibility
518c87b03e5Sespie@cindex compatibility, f2c
519c87b03e5Sespie@cindex f77 compatibility
520c87b03e5Sespie@cindex compatibility, f77
521c87b03e5SespieSpecify that the program is written in idiomatic UNIX FORTRAN 77
522c87b03e5Sespieand/or the dialect accepted by the @command{f2c} product.
523c87b03e5SespieSame as @samp{-fbackslash -fno-typeless-boz}.
524c87b03e5Sespie
525c87b03e5SespieThe meaning of this option is likely to be refined as future
526c87b03e5Sespieversions of @command{g77} provide more compatibility with other
527c87b03e5Sespieexisting and obsolete Fortran implementations.
528c87b03e5Sespie
529c87b03e5Sespie@cindex -fno-f77 option
530c87b03e5Sespie@cindex options, -fno-f77
531c87b03e5Sespie@item -fno-f77
532c87b03e5Sespie@cindex UNIX f77
533c87b03e5SespieThe @option{-fno-f77} option is @emph{not} the inverse
534c87b03e5Sespieof @option{-ff77}.
535c87b03e5SespieIt specifies that the program is not written in idiomatic UNIX
536c87b03e5SespieFORTRAN 77 or @command{f2c} but in a more widely portable dialect.
537c87b03e5Sespie@option{-fno-f77} is the same as @option{-fno-backslash}.
538c87b03e5Sespie
539c87b03e5SespieThe meaning of this option is likely to be refined as future
540c87b03e5Sespieversions of @command{g77} provide more compatibility with other
541c87b03e5Sespieexisting and obsolete Fortran implementations.
542c87b03e5Sespie@end table
543c87b03e5Sespie
544c87b03e5Sespie@node Fortran Dialect Options
545c87b03e5Sespie@section Options Controlling Fortran Dialect
546c87b03e5Sespie@cindex dialect options
547c87b03e5Sespie@cindex language, dialect options
548c87b03e5Sespie@cindex options, dialect
549c87b03e5Sespie
550c87b03e5SespieThe following options control the dialect of Fortran
551c87b03e5Sespiethat the compiler accepts:
552c87b03e5Sespie
553c87b03e5Sespie@table @gcctabopt
554c87b03e5Sespie@cindex -ffree-form option
555c87b03e5Sespie@cindex options, -ffree-form
556c87b03e5Sespie@cindex -fno-fixed-form option
557c87b03e5Sespie@cindex options, -fno-fixed-form
558c87b03e5Sespie@cindex source file format
559c87b03e5Sespie@cindex free form
560c87b03e5Sespie@cindex fixed form
561c87b03e5Sespie@cindex Fortran 90, features
562c87b03e5Sespie@item -ffree-form
563c87b03e5Sespie@item -fno-fixed-form
564c87b03e5SespieSpecify that the source file is written in free form
565c87b03e5Sespie(introduced in Fortran 90) instead of the more-traditional fixed form.
566c87b03e5Sespie
567c87b03e5Sespie@cindex -ff90 option
568c87b03e5Sespie@cindex options, -ff90
569c87b03e5Sespie@cindex Fortran 90, features
570c87b03e5Sespie@item -ff90
571c87b03e5SespieAllow certain Fortran-90 constructs.
572c87b03e5Sespie
573c87b03e5SespieThis option controls whether certain
574c87b03e5SespieFortran 90 constructs are recognized.
575c87b03e5Sespie(Other Fortran 90 constructs
576c87b03e5Sespiemight or might not be recognized depending on other options such as
577c87b03e5Sespie@option{-fvxt}, @option{-ff90-intrinsics-enable}, and the
578c87b03e5Sespiecurrent level of support for Fortran 90.)
579c87b03e5Sespie
580c87b03e5Sespie@xref{Fortran 90}, for more information.
581c87b03e5Sespie
582c87b03e5Sespie@cindex -fvxt option
583c87b03e5Sespie@cindex options, -fvxt
584c87b03e5Sespie@item -fvxt
585c87b03e5Sespie@cindex Fortran 90, features
586c87b03e5Sespie@cindex VXT extensions
587c87b03e5SespieSpecify the treatment of certain constructs that have different
588c87b03e5Sespiemeanings depending on whether the code is written in
589c87b03e5SespieGNU Fortran (based on FORTRAN 77 and akin to Fortran 90)
590c87b03e5Sespieor VXT Fortran (more like VAX FORTRAN).
591c87b03e5Sespie
592c87b03e5SespieThe default is @option{-fno-vxt}.
593c87b03e5Sespie@option{-fvxt} specifies that the VXT Fortran interpretations
594c87b03e5Sespiefor those constructs are to be chosen.
595c87b03e5Sespie
596c87b03e5Sespie@xref{VXT Fortran}, for more information.
597c87b03e5Sespie
598c87b03e5Sespie@cindex -fdollar-ok option
599c87b03e5Sespie@cindex options, -fdollar-ok
600c87b03e5Sespie@item -fdollar-ok
601c87b03e5Sespie@cindex dollar sign
602c87b03e5Sespie@cindex symbol names
603c87b03e5Sespie@cindex character set
604c87b03e5SespieAllow @samp{$} as a valid character in a symbol name.
605c87b03e5Sespie
606c87b03e5Sespie@cindex -fno-backslash option
607c87b03e5Sespie@cindex options, -fno-backslash
608c87b03e5Sespie@item -fno-backslash
609c87b03e5Sespie@cindex backslash
610c87b03e5Sespie@cindex character constants
611c87b03e5Sespie@cindex Hollerith constants
612c87b03e5SespieSpecify that @samp{\} is not to be specially interpreted in character
613c87b03e5Sespieand Hollerith constants a la C and many UNIX Fortran compilers.
614c87b03e5Sespie
615c87b03e5SespieFor example, with @option{-fbackslash} in effect, @samp{A\nB} specifies
616c87b03e5Sespiethree characters, with the second one being newline.
617c87b03e5SespieWith @option{-fno-backslash}, it specifies four characters,
618c87b03e5Sespie@samp{A}, @samp{\}, @samp{n}, and @samp{B}.
619c87b03e5Sespie
620c87b03e5SespieNote that @command{g77} implements a fairly general form of backslash
621c87b03e5Sespieprocessing that is incompatible with the narrower forms supported
622c87b03e5Sespieby some other compilers.
623c87b03e5SespieFor example, @samp{'A\003B'} is a three-character string in @command{g77}
624c87b03e5Sespiewhereas other compilers that support backslash might not support
625c87b03e5Sespiethe three-octal-digit form, and thus treat that string as longer
626c87b03e5Sespiethan three characters.
627c87b03e5Sespie
628c87b03e5Sespie@xref{Backslash in Constants}, for
629c87b03e5Sespieinformation on why @option{-fbackslash} is the default
630c87b03e5Sespieinstead of @option{-fno-backslash}.
631c87b03e5Sespie
632c87b03e5Sespie@cindex -fno-ugly-args option
633c87b03e5Sespie@cindex options, -fno-ugly-args
634c87b03e5Sespie@item -fno-ugly-args
635c87b03e5SespieDisallow passing Hollerith and typeless constants as actual
636c87b03e5Sespiearguments (for example, @samp{CALL FOO(4HABCD)}).
637c87b03e5Sespie
638c87b03e5Sespie@xref{Ugly Implicit Argument Conversion}, for more information.
639c87b03e5Sespie
640c87b03e5Sespie@cindex -fugly-assign option
641c87b03e5Sespie@cindex options, -fugly-assign
642c87b03e5Sespie@item -fugly-assign
643c87b03e5SespieUse the same storage for a given variable regardless of
644c87b03e5Sespiewhether it is used to hold an assigned-statement label
645c87b03e5Sespie(as in @samp{ASSIGN 10 TO I}) or used to hold numeric data
646c87b03e5Sespie(as in @samp{I = 3}).
647c87b03e5Sespie
648c87b03e5Sespie@xref{Ugly Assigned Labels}, for more information.
649c87b03e5Sespie
650c87b03e5Sespie@cindex -fugly-assumed option
651c87b03e5Sespie@cindex options, -fugly-assumed
652c87b03e5Sespie@item -fugly-assumed
653c87b03e5SespieAssume any dummy array with a final dimension specified as @samp{1}
654c87b03e5Sespieis really an assumed-size array, as if @samp{*} had been specified
655c87b03e5Sespiefor the final dimension instead of @samp{1}.
656c87b03e5Sespie
657c87b03e5SespieFor example, @samp{DIMENSION X(1)} is treated as if it
658c87b03e5Sespiehad read @samp{DIMENSION X(*)}.
659c87b03e5Sespie
660c87b03e5Sespie@xref{Ugly Assumed-Size Arrays}, for more information.
661c87b03e5Sespie
662c87b03e5Sespie@cindex -fugly-comma option
663c87b03e5Sespie@cindex options, -fugly-comma
664c87b03e5Sespie@item -fugly-comma
665c87b03e5SespieIn an external-procedure invocation,
666c87b03e5Sespietreat a trailing comma in the argument list
667c87b03e5Sespieas specification of a trailing null argument,
668c87b03e5Sespieand treat an empty argument list
669c87b03e5Sespieas specification of a single null argument.
670c87b03e5Sespie
671c87b03e5SespieFor example, @samp{CALL FOO(,)} is treated as
672c87b03e5Sespie@samp{CALL FOO(%VAL(0), %VAL(0))}.
673c87b03e5SespieThat is, @emph{two} null arguments are specified
674c87b03e5Sespieby the procedure call when @option{-fugly-comma} is in force.
675c87b03e5SespieAnd @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}.
676c87b03e5Sespie
677c87b03e5SespieThe default behavior, @option{-fno-ugly-comma}, is to ignore
678c87b03e5Sespiea single trailing comma in an argument list.
679c87b03e5SespieSo, by default, @samp{CALL FOO(X,)} is treated
680c87b03e5Sespieexactly the same as @samp{CALL FOO(X)}.
681c87b03e5Sespie
682c87b03e5Sespie@xref{Ugly Null Arguments}, for more information.
683c87b03e5Sespie
684c87b03e5Sespie@cindex -fugly-complex option
685c87b03e5Sespie@cindex options, -fugly-complex
686c87b03e5Sespie@item -fugly-complex
687c87b03e5SespieDo not complain about @samp{REAL(@var{expr})} or
688c87b03e5Sespie@samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX}
689c87b03e5Sespietype other than @code{COMPLEX(KIND=1)}---usually
690c87b03e5Sespiethis is used to permit @code{COMPLEX(KIND=2)}
691c87b03e5Sespie(@code{DOUBLE COMPLEX}) operands.
692c87b03e5Sespie
693c87b03e5SespieThe @option{-ff90} option controls the interpretation
694c87b03e5Sespieof this construct.
695c87b03e5Sespie
696c87b03e5Sespie@xref{Ugly Complex Part Extraction}, for more information.
697c87b03e5Sespie
698c87b03e5Sespie@cindex -fno-ugly-init option
699c87b03e5Sespie@cindex options, -fno-ugly-init
700c87b03e5Sespie@item -fno-ugly-init
701c87b03e5SespieDisallow use of Hollerith and typeless constants as initial
702c87b03e5Sespievalues (in @code{PARAMETER} and @code{DATA} statements), and
703c87b03e5Sespieuse of character constants to
704c87b03e5Sespieinitialize numeric types and vice versa.
705c87b03e5Sespie
706c87b03e5SespieFor example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by
707c87b03e5Sespie@option{-fno-ugly-init}.
708c87b03e5Sespie
709c87b03e5Sespie@xref{Ugly Conversion of Initializers}, for more information.
710c87b03e5Sespie
711c87b03e5Sespie@cindex -fugly-logint option
712c87b03e5Sespie@cindex options, -fugly-logint
713c87b03e5Sespie@item -fugly-logint
714c87b03e5SespieTreat @code{INTEGER} and @code{LOGICAL} variables and
715c87b03e5Sespieexpressions as potential stand-ins for each other.
716c87b03e5Sespie
717c87b03e5SespieFor example, automatic conversion between @code{INTEGER} and
718c87b03e5Sespie@code{LOGICAL} is enabled, for many contexts, via this option.
719c87b03e5Sespie
720c87b03e5Sespie@xref{Ugly Integer Conversions}, for more information.
721c87b03e5Sespie
722c87b03e5Sespie@cindex -fonetrip option
723c87b03e5Sespie@cindex options, -fonetrip
724c87b03e5Sespie@item -fonetrip
725c87b03e5Sespie@cindex FORTRAN 66
726c87b03e5Sespie@cindex @code{DO} loops, one-trip
727c87b03e5Sespie@cindex one-trip @code{DO} loops
728c87b03e5Sespie@cindex @code{DO} loops, zero-trip
729c87b03e5Sespie@cindex zero-trip @code{DO} loops
730c87b03e5Sespie@cindex compatibility, FORTRAN 66
731c87b03e5SespieExecutable iterative @code{DO} loops are to be executed at
732c87b03e5Sespieleast once each time they are reached.
733c87b03e5Sespie
734c87b03e5SespieANSI FORTRAN 77 and more recent versions of the Fortran standard
735c87b03e5Sespiespecify that the body of an iterative @code{DO} loop is not executed
736c87b03e5Sespieif the number of iterations calculated from the parameters of the
737c87b03e5Sespieloop is less than 1.
738c87b03e5Sespie(For example, @samp{DO 10 I = 1, 0}.)
739c87b03e5SespieSuch a loop is called a @dfn{zero-trip loop}.
740c87b03e5Sespie
741c87b03e5SespiePrior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops
742c87b03e5Sespiesuch that the body of a loop would be executed at least once, even
743c87b03e5Sespieif the iteration count was zero.
744c87b03e5SespieFortran code written assuming this behavior is said to require
745c87b03e5Sespie@dfn{one-trip loops}.
746c87b03e5SespieFor example, some code written to the FORTRAN 66 standard
747c87b03e5Sespieexpects this behavior from its @code{DO} loops, although that
748c87b03e5Sespiestandard did not specify this behavior.
749c87b03e5Sespie
750c87b03e5SespieThe @option{-fonetrip} option specifies that the source file(s) being
751c87b03e5Sespiecompiled require one-trip loops.
752c87b03e5Sespie
753c87b03e5SespieThis option affects only those loops specified by the (iterative) @code{DO}
754c87b03e5Sespiestatement and by implied-@code{DO} lists in I/O statements.
755c87b03e5SespieLoops specified by implied-@code{DO} lists in @code{DATA} and
756c87b03e5Sespiespecification (non-executable) statements are not affected.
757c87b03e5Sespie
758c87b03e5Sespie@cindex -ftypeless-boz option
759c87b03e5Sespie@cindex options, -ftypeless-boz
760c87b03e5Sespie@cindex prefix-radix constants
761c87b03e5Sespie@cindex constants, prefix-radix
762c87b03e5Sespie@cindex constants, types
763c87b03e5Sespie@cindex types, constants
764c87b03e5Sespie@item -ftypeless-boz
765c87b03e5SespieSpecifies that prefix-radix non-decimal constants, such as
766c87b03e5Sespie@samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}.
767c87b03e5Sespie
768c87b03e5SespieYou can test for yourself whether a particular compiler treats
769c87b03e5Sespiethe prefix form as @code{INTEGER(KIND=1)} or typeless by running the
770c87b03e5Sespiefollowing program:
771c87b03e5Sespie
772c87b03e5Sespie@smallexample
773c87b03e5SespieEQUIVALENCE (I, R)
774c87b03e5SespieR = Z'ABCD1234'
775c87b03e5SespieJ = Z'ABCD1234'
776c87b03e5SespieIF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS'
777c87b03e5SespieIF (J .NE. I) PRINT *, 'Prefix form is INTEGER'
778c87b03e5SespieEND
779c87b03e5Sespie@end smallexample
780c87b03e5Sespie
781c87b03e5SespieReports indicate that many compilers process this form as
782c87b03e5Sespie@code{INTEGER(KIND=1)}, though a few as typeless, and at least one
783c87b03e5Sespiebased on a command-line option specifying some kind of
784c87b03e5Sespiecompatibility.
785c87b03e5Sespie
786c87b03e5Sespie@cindex -fintrin-case-initcap option
787c87b03e5Sespie@cindex options, -fintrin-case-initcap
788c87b03e5Sespie@item -fintrin-case-initcap
789c87b03e5Sespie@cindex -fintrin-case-upper option
790c87b03e5Sespie@cindex options, -fintrin-case-upper
791c87b03e5Sespie@item -fintrin-case-upper
792c87b03e5Sespie@cindex -fintrin-case-lower option
793c87b03e5Sespie@cindex options, -fintrin-case-lower
794c87b03e5Sespie@item -fintrin-case-lower
795c87b03e5Sespie@cindex -fintrin-case-any option
796c87b03e5Sespie@cindex options, -fintrin-case-any
797c87b03e5Sespie@item -fintrin-case-any
798c87b03e5SespieSpecify expected case for intrinsic names.
799c87b03e5Sespie@option{-fintrin-case-lower} is the default.
800c87b03e5Sespie
801c87b03e5Sespie@cindex -fmatch-case-initcap option
802c87b03e5Sespie@cindex options, -fmatch-case-initcap
803c87b03e5Sespie@item -fmatch-case-initcap
804c87b03e5Sespie@cindex -fmatch-case-upper option
805c87b03e5Sespie@cindex options, -fmatch-case-upper
806c87b03e5Sespie@item -fmatch-case-upper
807c87b03e5Sespie@cindex -fmatch-case-lower option
808c87b03e5Sespie@cindex options, -fmatch-case-lower
809c87b03e5Sespie@item -fmatch-case-lower
810c87b03e5Sespie@cindex -fmatch-case-any option
811c87b03e5Sespie@cindex options, -fmatch-case-any
812c87b03e5Sespie@item -fmatch-case-any
813c87b03e5SespieSpecify expected case for keywords.
814c87b03e5Sespie@option{-fmatch-case-lower} is the default.
815c87b03e5Sespie
816c87b03e5Sespie@cindex -fsource-case-upper option
817c87b03e5Sespie@cindex options, -fsource-case-upper
818c87b03e5Sespie@item -fsource-case-upper
819c87b03e5Sespie@cindex -fsource-case-lower option
820c87b03e5Sespie@cindex options, -fsource-case-lower
821c87b03e5Sespie@item -fsource-case-lower
822c87b03e5Sespie@cindex -fsource-case-preserve option
823c87b03e5Sespie@cindex options, -fsource-case-preserve
824c87b03e5Sespie@item -fsource-case-preserve
825c87b03e5SespieSpecify whether source text other than character and Hollerith constants
826c87b03e5Sespieis to be translated to uppercase, to lowercase, or preserved as is.
827c87b03e5Sespie@option{-fsource-case-lower} is the default.
828c87b03e5Sespie
829c87b03e5Sespie@cindex -fsymbol-case-initcap option
830c87b03e5Sespie@cindex options, -fsymbol-case-initcap
831c87b03e5Sespie@item -fsymbol-case-initcap
832c87b03e5Sespie@cindex -fsymbol-case-upper option
833c87b03e5Sespie@cindex options, -fsymbol-case-upper
834c87b03e5Sespie@item -fsymbol-case-upper
835c87b03e5Sespie@cindex -fsymbol-case-lower option
836c87b03e5Sespie@cindex options, -fsymbol-case-lower
837c87b03e5Sespie@item -fsymbol-case-lower
838c87b03e5Sespie@cindex -fsymbol-case-any option
839c87b03e5Sespie@cindex options, -fsymbol-case-any
840c87b03e5Sespie@item -fsymbol-case-any
841c87b03e5SespieSpecify valid cases for user-defined symbol names.
842c87b03e5Sespie@option{-fsymbol-case-any} is the default.
843c87b03e5Sespie
844c87b03e5Sespie@cindex -fcase-strict-upper option
845c87b03e5Sespie@cindex options, -fcase-strict-upper
846c87b03e5Sespie@item -fcase-strict-upper
847c87b03e5SespieSame as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve
848c87b03e5Sespie-fsymbol-case-upper}.
849c87b03e5Sespie(Requires all pertinent source to be in uppercase.)
850c87b03e5Sespie
851c87b03e5Sespie@cindex -fcase-strict-lower option
852c87b03e5Sespie@cindex options, -fcase-strict-lower
853c87b03e5Sespie@item -fcase-strict-lower
854c87b03e5SespieSame as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve
855c87b03e5Sespie-fsymbol-case-lower}.
856c87b03e5Sespie(Requires all pertinent source to be in lowercase.)
857c87b03e5Sespie
858c87b03e5Sespie@cindex -fcase-initcap option
859c87b03e5Sespie@cindex options, -fcase-initcap
860c87b03e5Sespie@item -fcase-initcap
861c87b03e5SespieSame as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve
862c87b03e5Sespie-fsymbol-case-initcap}.
863c87b03e5Sespie(Requires all pertinent source to be in initial capitals,
864c87b03e5Sespieas in @samp{Print *,SqRt(Value)}.)
865c87b03e5Sespie
866c87b03e5Sespie@cindex -fcase-upper option
867c87b03e5Sespie@cindex options, -fcase-upper
868c87b03e5Sespie@item -fcase-upper
869c87b03e5SespieSame as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper
870c87b03e5Sespie-fsymbol-case-any}.
871c87b03e5Sespie(Maps all pertinent source to uppercase.)
872c87b03e5Sespie
873c87b03e5Sespie@cindex -fcase-lower option
874c87b03e5Sespie@cindex options, -fcase-lower
875c87b03e5Sespie@item -fcase-lower
876c87b03e5SespieSame as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower
877c87b03e5Sespie-fsymbol-case-any}.
878c87b03e5Sespie(Maps all pertinent source to lowercase.)
879c87b03e5Sespie
880c87b03e5Sespie@cindex -fcase-preserve option
881c87b03e5Sespie@cindex options, -fcase-preserve
882c87b03e5Sespie@item -fcase-preserve
883c87b03e5SespieSame as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-preserve
884c87b03e5Sespie-fsymbol-case-any}.
885c87b03e5Sespie(Preserves all case in user-defined symbols,
886c87b03e5Sespiewhile allowing any-case matching of intrinsics and keywords.
887c87b03e5SespieFor example, @samp{call Foo(i,I)} would pass two @emph{different}
888c87b03e5Sespievariables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.)
889c87b03e5Sespie
890c87b03e5Sespie@cindex -fbadu77-intrinsics-delete option
891c87b03e5Sespie@cindex options, -fbadu77-intrinsics-delete
892c87b03e5Sespie@item -fbadu77-intrinsics-delete
893c87b03e5Sespie@cindex -fbadu77-intrinsics-hide option
894c87b03e5Sespie@cindex options, -fbadu77-intrinsics-hide
895c87b03e5Sespie@item -fbadu77-intrinsics-hide
896c87b03e5Sespie@cindex -fbadu77-intrinsics-disable option
897c87b03e5Sespie@cindex options, -fbadu77-intrinsics-disable
898c87b03e5Sespie@item -fbadu77-intrinsics-disable
899c87b03e5Sespie@cindex -fbadu77-intrinsics-enable option
900c87b03e5Sespie@cindex options, -fbadu77-intrinsics-enable
901c87b03e5Sespie@item -fbadu77-intrinsics-enable
902c87b03e5Sespie@cindex @code{badu77} intrinsics
903c87b03e5Sespie@cindex intrinsics, @code{badu77}
904c87b03e5SespieSpecify status of UNIX intrinsics having inappropriate forms.
905c87b03e5Sespie@option{-fbadu77-intrinsics-enable} is the default.
906c87b03e5Sespie@xref{Intrinsic Groups}.
907c87b03e5Sespie
908c87b03e5Sespie@cindex -ff2c-intrinsics-delete option
909c87b03e5Sespie@cindex options, -ff2c-intrinsics-delete
910c87b03e5Sespie@item -ff2c-intrinsics-delete
911c87b03e5Sespie@cindex -ff2c-intrinsics-hide option
912c87b03e5Sespie@cindex options, -ff2c-intrinsics-hide
913c87b03e5Sespie@item -ff2c-intrinsics-hide
914c87b03e5Sespie@cindex -ff2c-intrinsics-disable option
915c87b03e5Sespie@cindex options, -ff2c-intrinsics-disable
916c87b03e5Sespie@item -ff2c-intrinsics-disable
917c87b03e5Sespie@cindex -ff2c-intrinsics-enable option
918c87b03e5Sespie@cindex options, -ff2c-intrinsics-enable
919c87b03e5Sespie@item -ff2c-intrinsics-enable
920c87b03e5Sespie@cindex @command{f2c} intrinsics
921c87b03e5Sespie@cindex intrinsics, @command{f2c}
922c87b03e5SespieSpecify status of f2c-specific intrinsics.
923c87b03e5Sespie@option{-ff2c-intrinsics-enable} is the default.
924c87b03e5Sespie@xref{Intrinsic Groups}.
925c87b03e5Sespie
926c87b03e5Sespie@cindex -ff90-intrinsics-delete option
927c87b03e5Sespie@cindex options, -ff90-intrinsics-delete
928c87b03e5Sespie@item -ff90-intrinsics-delete
929c87b03e5Sespie@cindex -ff90-intrinsics-hide option
930c87b03e5Sespie@cindex options, -ff90-intrinsics-hide
931c87b03e5Sespie@item -ff90-intrinsics-hide
932c87b03e5Sespie@cindex -ff90-intrinsics-disable option
933c87b03e5Sespie@cindex options, -ff90-intrinsics-disable
934c87b03e5Sespie@item -ff90-intrinsics-disable
935c87b03e5Sespie@cindex -ff90-intrinsics-enable option
936c87b03e5Sespie@cindex options, -ff90-intrinsics-enable
937c87b03e5Sespie@item -ff90-intrinsics-enable
938c87b03e5Sespie@cindex Fortran 90, intrinsics
939c87b03e5Sespie@cindex intrinsics, Fortran 90
940c87b03e5SespieSpecify status of F90-specific intrinsics.
941c87b03e5Sespie@option{-ff90-intrinsics-enable} is the default.
942c87b03e5Sespie@xref{Intrinsic Groups}.
943c87b03e5Sespie
944c87b03e5Sespie@cindex -fgnu-intrinsics-delete option
945c87b03e5Sespie@cindex options, -fgnu-intrinsics-delete
946c87b03e5Sespie@item -fgnu-intrinsics-delete
947c87b03e5Sespie@cindex -fgnu-intrinsics-hide option
948c87b03e5Sespie@cindex options, -fgnu-intrinsics-hide
949c87b03e5Sespie@item -fgnu-intrinsics-hide
950c87b03e5Sespie@cindex -fgnu-intrinsics-disable option
951c87b03e5Sespie@cindex options, -fgnu-intrinsics-disable
952c87b03e5Sespie@item -fgnu-intrinsics-disable
953c87b03e5Sespie@cindex -fgnu-intrinsics-enable option
954c87b03e5Sespie@cindex options, -fgnu-intrinsics-enable
955c87b03e5Sespie@item -fgnu-intrinsics-enable
956c87b03e5Sespie@cindex Digital Fortran features
957c87b03e5Sespie@cindex @code{COMPLEX} intrinsics
958c87b03e5Sespie@cindex intrinsics, @code{COMPLEX}
959c87b03e5SespieSpecify status of Digital's COMPLEX-related intrinsics.
960c87b03e5Sespie@option{-fgnu-intrinsics-enable} is the default.
961c87b03e5Sespie@xref{Intrinsic Groups}.
962c87b03e5Sespie
963c87b03e5Sespie@cindex -fmil-intrinsics-delete option
964c87b03e5Sespie@cindex options, -fmil-intrinsics-delete
965c87b03e5Sespie@item -fmil-intrinsics-delete
966c87b03e5Sespie@cindex -fmil-intrinsics-hide option
967c87b03e5Sespie@cindex options, -fmil-intrinsics-hide
968c87b03e5Sespie@item -fmil-intrinsics-hide
969c87b03e5Sespie@cindex -fmil-intrinsics-disable option
970c87b03e5Sespie@cindex options, -fmil-intrinsics-disable
971c87b03e5Sespie@item -fmil-intrinsics-disable
972c87b03e5Sespie@cindex -fmil-intrinsics-enable option
973c87b03e5Sespie@cindex options, -fmil-intrinsics-enable
974c87b03e5Sespie@item -fmil-intrinsics-enable
975c87b03e5Sespie@cindex MIL-STD 1753
976c87b03e5Sespie@cindex intrinsics, MIL-STD 1753
977c87b03e5SespieSpecify status of MIL-STD-1753-specific intrinsics.
978c87b03e5Sespie@option{-fmil-intrinsics-enable} is the default.
979c87b03e5Sespie@xref{Intrinsic Groups}.
980c87b03e5Sespie
981c87b03e5Sespie@cindex -funix-intrinsics-delete option
982c87b03e5Sespie@cindex options, -funix-intrinsics-delete
983c87b03e5Sespie@item -funix-intrinsics-delete
984c87b03e5Sespie@cindex -funix-intrinsics-hide option
985c87b03e5Sespie@cindex options, -funix-intrinsics-hide
986c87b03e5Sespie@item -funix-intrinsics-hide
987c87b03e5Sespie@cindex -funix-intrinsics-disable option
988c87b03e5Sespie@cindex options, -funix-intrinsics-disable
989c87b03e5Sespie@item -funix-intrinsics-disable
990c87b03e5Sespie@cindex -funix-intrinsics-enable option
991c87b03e5Sespie@cindex options, -funix-intrinsics-enable
992c87b03e5Sespie@item -funix-intrinsics-enable
993c87b03e5Sespie@cindex UNIX intrinsics
994c87b03e5Sespie@cindex intrinsics, UNIX
995c87b03e5SespieSpecify status of UNIX intrinsics.
996c87b03e5Sespie@option{-funix-intrinsics-enable} is the default.
997c87b03e5Sespie@xref{Intrinsic Groups}.
998c87b03e5Sespie
999c87b03e5Sespie@cindex -fvxt-intrinsics-delete option
1000c87b03e5Sespie@cindex options, -fvxt-intrinsics-delete
1001c87b03e5Sespie@item -fvxt-intrinsics-delete
1002c87b03e5Sespie@cindex -fvxt-intrinsics-hide option
1003c87b03e5Sespie@cindex options, -fvxt-intrinsics-hide
1004c87b03e5Sespie@item -fvxt-intrinsics-hide
1005c87b03e5Sespie@cindex -fvxt-intrinsics-disable option
1006c87b03e5Sespie@cindex options, -fvxt-intrinsics-disable
1007c87b03e5Sespie@item -fvxt-intrinsics-disable
1008c87b03e5Sespie@cindex -fvxt-intrinsics-enable option
1009c87b03e5Sespie@cindex options, -fvxt-intrinsics-enable
1010c87b03e5Sespie@item -fvxt-intrinsics-enable
1011c87b03e5Sespie@cindex VXT intrinsics
1012c87b03e5Sespie@cindex intrinsics, VXT
1013c87b03e5SespieSpecify status of VXT intrinsics.
1014c87b03e5Sespie@option{-fvxt-intrinsics-enable} is the default.
1015c87b03e5Sespie@xref{Intrinsic Groups}.
1016c87b03e5Sespie
1017c87b03e5Sespie@cindex -ffixed-line-length-@var{n} option
1018c87b03e5Sespie@cindex options, -ffixed-line-length-@var{n}
1019c87b03e5Sespie@item -ffixed-line-length-@var{n}
1020c87b03e5Sespie@cindex source file format
1021c87b03e5Sespie@cindex lines, length
1022c87b03e5Sespie@cindex length of source lines
1023c87b03e5Sespie@cindex fixed form
1024c87b03e5Sespie@cindex limits, lengths of source lines
1025c87b03e5SespieSet column after which characters are ignored in typical fixed-form
1026c87b03e5Sespielines in the source file, and through which spaces are assumed (as
1027c87b03e5Sespieif padded to that length) after the ends of short fixed-form lines.
1028c87b03e5Sespie
1029c87b03e5Sespie@cindex card image
1030c87b03e5Sespie@cindex extended-source option
1031c87b03e5SespiePopular values for @var{n} include 72 (the
1032c87b03e5Sespiestandard and the default), 80 (card image), and 132 (corresponds
1033c87b03e5Sespieto ``extended-source'' options in some popular compilers).
1034c87b03e5Sespie@var{n} may be @samp{none}, meaning that the entire line is meaningful
1035c87b03e5Sespieand that continued character constants never have implicit spaces appended
1036c87b03e5Sespieto them to fill out the line.
1037c87b03e5Sespie@option{-ffixed-line-length-0} means the same thing as
1038c87b03e5Sespie@option{-ffixed-line-length-none}.
1039c87b03e5Sespie
1040c87b03e5Sespie@xref{Source Form}, for more information.
1041c87b03e5Sespie@end table
1042c87b03e5Sespie
1043c87b03e5Sespie@node Warning Options
1044c87b03e5Sespie@section Options to Request or Suppress Warnings
1045c87b03e5Sespie@cindex options, warnings
1046c87b03e5Sespie@cindex warnings, suppressing
1047c87b03e5Sespie@cindex messages, warning
1048c87b03e5Sespie@cindex suppressing warnings
1049c87b03e5Sespie
1050c87b03e5SespieWarnings are diagnostic messages that report constructions which
1051c87b03e5Sespieare not inherently erroneous but which are risky or suggest there
1052c87b03e5Sespiemight have been an error.
1053c87b03e5Sespie
1054c87b03e5SespieYou can request many specific warnings with options beginning @option{-W},
1055c87b03e5Sespiefor example @option{-Wimplicit} to request warnings on implicit
1056c87b03e5Sespiedeclarations.  Each of these specific warning options also has a
1057c87b03e5Sespienegative form beginning @option{-Wno-} to turn off warnings;
1058c87b03e5Sespiefor example, @option{-Wno-implicit}.  This manual lists only one of the
1059c87b03e5Sespietwo forms, whichever is not the default.
1060c87b03e5Sespie
1061c87b03e5SespieThese options control the amount and kinds of warnings produced by GNU
1062c87b03e5SespieFortran:
1063c87b03e5Sespie
1064c87b03e5Sespie@table @gcctabopt
1065c87b03e5Sespie@cindex syntax checking
1066c87b03e5Sespie@cindex -fsyntax-only option
1067c87b03e5Sespie@cindex options, -fsyntax-only
1068c87b03e5Sespie@item -fsyntax-only
1069c87b03e5SespieCheck the code for syntax errors, but don't do anything beyond that.
1070c87b03e5Sespie
1071c87b03e5Sespie@cindex -pedantic option
1072c87b03e5Sespie@cindex options, -pedantic
1073c87b03e5Sespie@item -pedantic
1074c87b03e5SespieIssue warnings for uses of extensions to ANSI FORTRAN 77.
1075c87b03e5Sespie@option{-pedantic} also applies to C-language constructs where they
1076c87b03e5Sespieoccur in GNU Fortran source files, such as use of @samp{\e} in a
1077c87b03e5Sespiecharacter constant within a directive like @samp{#include}.
1078c87b03e5Sespie
1079c87b03e5SespieValid ANSI FORTRAN 77 programs should compile properly with or without
1080c87b03e5Sespiethis option.
1081c87b03e5SespieHowever, without this option, certain GNU extensions and traditional
1082c87b03e5SespieFortran features are supported as well.
1083c87b03e5SespieWith this option, many of them are rejected.
1084c87b03e5Sespie
1085c87b03e5SespieSome users try to use @option{-pedantic} to check programs for strict ANSI
1086c87b03e5Sespieconformance.
1087c87b03e5SespieThey soon find that it does not do quite what they want---it finds some
1088c87b03e5Sespienon-ANSI practices, but not all.
1089c87b03e5SespieHowever, improvements to @command{g77} in this area are welcome.
1090c87b03e5Sespie
1091c87b03e5Sespie@cindex -pedantic-errors option
1092c87b03e5Sespie@cindex options, -pedantic-errors
1093c87b03e5Sespie@item -pedantic-errors
1094c87b03e5SespieLike @option{-pedantic}, except that errors are produced rather than
1095c87b03e5Sespiewarnings.
1096c87b03e5Sespie
1097c87b03e5Sespie@cindex -fpedantic option
1098c87b03e5Sespie@cindex options, -fpedantic
1099c87b03e5Sespie@item -fpedantic
1100c87b03e5SespieLike @option{-pedantic}, but applies only to Fortran constructs.
1101c87b03e5Sespie
1102c87b03e5Sespie@cindex -w option
1103c87b03e5Sespie@cindex options, -w
1104c87b03e5Sespie@item -w
1105c87b03e5SespieInhibit all warning messages.
1106c87b03e5Sespie
1107c87b03e5Sespie@cindex -Wno-globals option
1108c87b03e5Sespie@cindex options, -Wno-globals
1109c87b03e5Sespie@item -Wno-globals
1110c87b03e5Sespie@cindex global names, warning
1111c87b03e5Sespie@cindex warnings, global names
1112c87b03e5SespieInhibit warnings about use of a name as both a global name
1113c87b03e5Sespie(a subroutine, function, or block data program unit, or a
1114c87b03e5Sespiecommon block) and implicitly as the name of an intrinsic
1115c87b03e5Sespiein a source file.
1116c87b03e5Sespie
1117c87b03e5SespieAlso inhibit warnings about inconsistent invocations and/or
1118c87b03e5Sespiedefinitions of global procedures (function and subroutines).
1119c87b03e5SespieSuch inconsistencies include different numbers of arguments
1120c87b03e5Sespieand different types of arguments.
1121c87b03e5Sespie
1122c87b03e5Sespie@cindex -Wimplicit option
1123c87b03e5Sespie@cindex options, -Wimplicit
1124c87b03e5Sespie@item -Wimplicit
1125c87b03e5Sespie@cindex implicit declaration, warning
1126c87b03e5Sespie@cindex warnings, implicit declaration
1127c87b03e5Sespie@cindex -u option
1128c87b03e5Sespie@cindex /WARNINGS=DECLARATIONS switch
1129c87b03e5Sespie@cindex IMPLICIT NONE, similar effect
1130c87b03e5Sespie@cindex effecting IMPLICIT NONE
1131c87b03e5SespieWarn whenever a variable, array, or function is implicitly
1132c87b03e5Sespiedeclared.
1133c87b03e5SespieHas an effect similar to using the @code{IMPLICIT NONE} statement
1134c87b03e5Sespiein every program unit.
1135c87b03e5Sespie(Some Fortran compilers provide this feature by an option
1136c87b03e5Sespienamed @option{-u} or @samp{/WARNINGS=DECLARATIONS}.)
1137c87b03e5Sespie
1138c87b03e5Sespie@cindex -Wunused option
1139c87b03e5Sespie@cindex options, -Wunused
1140c87b03e5Sespie@item -Wunused
1141c87b03e5Sespie@cindex unused variables
1142c87b03e5Sespie@cindex variables, unused
1143c87b03e5SespieWarn whenever a variable is unused aside from its declaration.
1144c87b03e5Sespie
1145c87b03e5Sespie@cindex -Wuninitialized option
1146c87b03e5Sespie@cindex options, -Wuninitialized
1147c87b03e5Sespie@item -Wuninitialized
1148c87b03e5Sespie@cindex uninitialized variables
1149c87b03e5Sespie@cindex variables, uninitialized
1150c87b03e5SespieWarn whenever an automatic variable is used without first being initialized.
1151c87b03e5Sespie
1152c87b03e5SespieThese warnings are possible only in optimizing compilation,
1153c87b03e5Sespiebecause they require data-flow information that is computed only
1154c87b03e5Sespiewhen optimizing.  If you don't specify @option{-O}, you simply won't
1155c87b03e5Sespieget these warnings.
1156c87b03e5Sespie
1157c87b03e5SespieThese warnings occur only for variables that are candidates for
1158c87b03e5Sespieregister allocation.  Therefore, they do not occur for a variable
1159c87b03e5Sespie@c that is declared @code{VOLATILE}, or
1160c87b03e5Sespiewhose address is taken, or whose size
1161c87b03e5Sespieis other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
1162c87b03e5Sespiearrays, even when they are in registers.
1163c87b03e5Sespie
1164c87b03e5SespieNote that there might be no warning about a variable that is used only
1165c87b03e5Sespieto compute a value that itself is never used, because such
1166c87b03e5Sespiecomputations may be deleted by data-flow analysis before the warnings
1167c87b03e5Sespieare printed.
1168c87b03e5Sespie
1169c87b03e5SespieThese warnings are made optional because GNU Fortran is not smart
1170c87b03e5Sespieenough to see all the reasons why the code might be correct
1171c87b03e5Sespiedespite appearing to have an error.  Here is one example of how
1172c87b03e5Sespiethis can happen:
1173c87b03e5Sespie
1174c87b03e5Sespie@example
1175c87b03e5SespieSUBROUTINE DISPAT(J)
1176c87b03e5SespieIF (J.EQ.1) I=1
1177c87b03e5SespieIF (J.EQ.2) I=4
1178c87b03e5SespieIF (J.EQ.3) I=5
1179c87b03e5SespieCALL FOO(I)
1180c87b03e5SespieEND
1181c87b03e5Sespie@end example
1182c87b03e5Sespie
1183c87b03e5Sespie@noindent
1184c87b03e5SespieIf the value of @code{J} is always 1, 2 or 3, then @code{I} is
1185c87b03e5Sespiealways initialized, but GNU Fortran doesn't know this.  Here is
1186c87b03e5Sespieanother common case:
1187c87b03e5Sespie
1188c87b03e5Sespie@example
1189c87b03e5SespieSUBROUTINE MAYBE(FLAG)
1190c87b03e5SespieLOGICAL FLAG
1191c87b03e5SespieIF (FLAG) VALUE = 9.4
1192c87b03e5Sespie@dots{}
1193c87b03e5SespieIF (FLAG) PRINT *, VALUE
1194c87b03e5SespieEND
1195c87b03e5Sespie@end example
1196c87b03e5Sespie
1197c87b03e5Sespie@noindent
1198c87b03e5SespieThis has no bug because @code{VALUE} is used only if it is set.
1199c87b03e5Sespie
1200c87b03e5Sespie@cindex -Wall option
1201c87b03e5Sespie@cindex options, -Wall
1202c87b03e5Sespie@item -Wall
1203c87b03e5Sespie@cindex all warnings
1204c87b03e5Sespie@cindex warnings, all
1205c87b03e5SespieThe @option{-Wunused} and @option{-Wuninitialized} options combined.
1206c87b03e5SespieThese are all the
1207c87b03e5Sespieoptions which pertain to usage that we recommend avoiding and that we
1208c87b03e5Sespiebelieve is easy to avoid.
1209c87b03e5Sespie(As more warnings are added to @command{g77} some might
1210c87b03e5Sespiebe added to the list enabled by @option{-Wall}.)
1211c87b03e5Sespie@end table
1212c87b03e5Sespie
1213c87b03e5SespieThe remaining @option{-W@dots{}} options are not implied by @option{-Wall}
1214c87b03e5Sespiebecause they warn about constructions that we consider reasonable to
1215c87b03e5Sespieuse, on occasion, in clean programs.
1216c87b03e5Sespie
1217c87b03e5Sespie@table @gcctabopt
1218c87b03e5Sespie@c @item -W
1219c87b03e5Sespie@c Print extra warning messages for these events:
1220c87b03e5Sespie@c
1221c87b03e5Sespie@c @itemize @bullet
1222c87b03e5Sespie@c @item
1223c87b03e5Sespie@c If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
1224c87b03e5Sespie@c arguments.
1225c87b03e5Sespie@c
1226c87b03e5Sespie@c @end itemize
1227c87b03e5Sespie@c
1228c87b03e5Sespie@cindex -Wsurprising option
1229c87b03e5Sespie@cindex options, -Wsurprising
1230c87b03e5Sespie@item -Wsurprising
1231c87b03e5SespieWarn about ``suspicious'' constructs that are interpreted
1232c87b03e5Sespieby the compiler in a way that might well be surprising to
1233c87b03e5Sespiesomeone reading the code.
1234c87b03e5SespieThese differences can result in subtle, compiler-dependent
1235c87b03e5Sespie(even machine-dependent) behavioral differences.
1236c87b03e5SespieThe constructs warned about include:
1237c87b03e5Sespie
1238c87b03e5Sespie@itemize @bullet
1239c87b03e5Sespie@item
1240c87b03e5SespieExpressions having two arithmetic operators in a row, such
1241c87b03e5Sespieas @samp{X*-Y}.
1242c87b03e5SespieSuch a construct is nonstandard, and can produce
1243c87b03e5Sespieunexpected results in more complicated situations such
1244c87b03e5Sespieas @samp{X**-Y*Z}.
1245c87b03e5Sespie@command{g77} along with many other compilers, interprets
1246c87b03e5Sespiethis example differently than many programmers, and a few
1247c87b03e5Sespieother compilers.
1248c87b03e5SespieSpecifically, @command{g77} interprets @samp{X**-Y*Z} as
1249c87b03e5Sespie@samp{(X**(-Y))*Z}, while others might think it should
1250c87b03e5Sespiebe interpreted as @samp{X**(-(Y*Z))}.
1251c87b03e5Sespie
1252c87b03e5SespieA revealing example is the constant expression @samp{2**-2*1.},
1253c87b03e5Sespiewhich @command{g77} evaluates to .25, while others might evaluate
1254c87b03e5Sespieit to 0., the difference resulting from the way precedence affects
1255c87b03e5Sespietype promotion.
1256c87b03e5Sespie
1257c87b03e5Sespie(The @option{-fpedantic} option also warns about expressions
1258c87b03e5Sespiehaving two arithmetic operators in a row.)
1259c87b03e5Sespie
1260c87b03e5Sespie@item
1261c87b03e5SespieExpressions with a unary minus followed by an operand and then
1262c87b03e5Sespiea binary operator other than plus or minus.
1263c87b03e5SespieFor example, @samp{-2**2} produces a warning, because
1264c87b03e5Sespiethe precedence is @samp{-(2**2)}, yielding -4, not
1265c87b03e5Sespie@samp{(-2)**2}, which yields 4, and which might represent
1266c87b03e5Sespiewhat a programmer expects.
1267c87b03e5Sespie
1268c87b03e5SespieAn example of an expression producing different results
1269c87b03e5Sespiein a surprising way is @samp{-I*S}, where @var{I} holds
1270c87b03e5Sespiethe value @samp{-2147483648} and @var{S} holds @samp{0.5}.
1271c87b03e5SespieOn many systems, negating @var{I} results in the same
1272c87b03e5Sespievalue, not a positive number, because it is already the
1273c87b03e5Sespielower bound of what an @code{INTEGER(KIND=1)} variable can hold.
1274c87b03e5SespieSo, the expression evaluates to a positive number, while
1275c87b03e5Sespiethe ``expected'' interpretation, @samp{(-I)*S}, would
1276c87b03e5Sespieevaluate to a negative number.
1277c87b03e5Sespie
1278c87b03e5SespieEven cases such as @samp{-I*J} produce warnings,
1279c87b03e5Sespieeven though, in most configurations and situations,
1280c87b03e5Sespiethere is no computational difference between the
1281c87b03e5Sespieresults of the two interpretations---the purpose
1282c87b03e5Sespieof this warning is to warn about differing interpretations
1283c87b03e5Sespieand encourage a better style of coding, not to identify
1284c87b03e5Sespieonly those places where bugs might exist in the user's
1285c87b03e5Sespiecode.
1286c87b03e5Sespie
1287c87b03e5Sespie@cindex DO statement
1288c87b03e5Sespie@cindex statements, DO
1289c87b03e5Sespie@item
1290c87b03e5Sespie@code{DO} loops with @code{DO} variables that are not
1291c87b03e5Sespieof integral type---that is, using @code{REAL}
1292c87b03e5Sespievariables as loop control variables.
1293c87b03e5SespieAlthough such loops can be written to work in the
1294c87b03e5Sespie``obvious'' way, the way @command{g77} is required by the
1295c87b03e5SespieFortran standard to interpret such code is likely to
1296c87b03e5Sespiebe quite different from the way many programmers expect.
1297c87b03e5Sespie(This is true of all @code{DO} loops, but the differences
1298c87b03e5Sespieare pronounced for non-integral loop control variables.)
1299c87b03e5Sespie
1300c87b03e5Sespie@xref{Loops}, for more information.
1301c87b03e5Sespie@end itemize
1302c87b03e5Sespie
1303c87b03e5Sespie@cindex -Werror option
1304c87b03e5Sespie@cindex options, -Werror
1305c87b03e5Sespie@item -Werror
1306c87b03e5SespieMake all warnings into errors.
1307c87b03e5Sespie
1308c87b03e5Sespie@cindex -W option
1309c87b03e5Sespie@cindex options, -W
1310c87b03e5Sespie@item -W
1311c87b03e5Sespie@cindex extra warnings
1312c87b03e5Sespie@cindex warnings, extra
1313c87b03e5SespieTurns on ``extra warnings'' and, if optimization is specified
1314c87b03e5Sespievia @option{-O}, the @option{-Wuninitialized} option.
1315c87b03e5Sespie(This might change in future versions of @command{g77}
1316c87b03e5Sespie
1317c87b03e5Sespie``Extra warnings'' are issued for:
1318c87b03e5Sespie
1319c87b03e5Sespie@itemize @bullet
1320c87b03e5Sespie@item
1321c87b03e5Sespie@cindex unused parameters
1322c87b03e5Sespie@cindex parameters, unused
1323c87b03e5Sespie@cindex unused arguments
1324c87b03e5Sespie@cindex arguments, unused
1325c87b03e5Sespie@cindex unused dummies
1326c87b03e5Sespie@cindex dummies, unused
1327c87b03e5SespieUnused parameters to a procedure (when @option{-Wunused} also is
1328c87b03e5Sespiespecified).
1329c87b03e5Sespie
1330c87b03e5Sespie@item
1331c87b03e5Sespie@cindex overflow
1332c87b03e5SespieOverflows involving floating-point constants (not available
1333c87b03e5Sespiefor certain configurations).
1334c87b03e5Sespie@end itemize
1335c87b03e5Sespie@end table
1336c87b03e5Sespie
1337c87b03e5Sespie@xref{Warning Options,,Options to Request or Suppress Warnings,
1338c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information on more
1339c87b03e5Sespieoptions offered
1340c87b03e5Sespieby the GBE shared by @command{g77} @command{gcc} and other GNU compilers.
1341c87b03e5Sespie
1342c87b03e5SespieSome of these have no effect when compiling programs written in Fortran:
1343c87b03e5Sespie
1344c87b03e5Sespie@table @gcctabopt
1345c87b03e5Sespie@cindex -Wcomment option
1346c87b03e5Sespie@cindex options, -Wcomment
1347c87b03e5Sespie@item -Wcomment
1348c87b03e5Sespie@cindex -Wformat option
1349c87b03e5Sespie@cindex options, -Wformat
1350c87b03e5Sespie@item -Wformat
1351c87b03e5Sespie@cindex -Wparentheses option
1352c87b03e5Sespie@cindex options, -Wparentheses
1353c87b03e5Sespie@item -Wparentheses
1354c87b03e5Sespie@cindex -Wswitch option
1355c87b03e5Sespie@cindex options, -Wswitch
1356c87b03e5Sespie@item -Wswitch
1357c87b03e5Sespie@cindex -Wswitch-default option
1358c87b03e5Sespie@cindex options, -Wswitch-default
1359c87b03e5Sespie@item -Wswitch-default
1360c87b03e5Sespie@cindex -Wswitch-enum option
1361c87b03e5Sespie@cindex options, -Wswitch-enum
1362c87b03e5Sespie@item -Wswitch-enum
1363c87b03e5Sespie@cindex -Wtraditional option
1364c87b03e5Sespie@cindex options, -Wtraditional
1365c87b03e5Sespie@item -Wtraditional
1366c87b03e5Sespie@cindex -Wshadow option
1367c87b03e5Sespie@cindex options, -Wshadow
1368c87b03e5Sespie@item -Wshadow
1369c87b03e5Sespie@cindex -Wid-clash-@var{len} option
1370c87b03e5Sespie@cindex options, -Wid-clash-@var{len}
1371c87b03e5Sespie@item -Wid-clash-@var{len}
1372c87b03e5Sespie@cindex -Wlarger-than-@var{len} option
1373c87b03e5Sespie@cindex options, -Wlarger-than-@var{len}
1374c87b03e5Sespie@item -Wlarger-than-@var{len}
1375c87b03e5Sespie@cindex -Wconversion option
1376c87b03e5Sespie@cindex options, -Wconversion
1377c87b03e5Sespie@item -Wconversion
1378c87b03e5Sespie@cindex -Waggregate-return option
1379c87b03e5Sespie@cindex options, -Waggregate-return
1380c87b03e5Sespie@item -Waggregate-return
1381c87b03e5Sespie@cindex -Wredundant-decls option
1382c87b03e5Sespie@cindex options, -Wredundant-decls
1383c87b03e5Sespie@item -Wredundant-decls
1384c87b03e5Sespie@cindex unsupported warnings
1385c87b03e5Sespie@cindex warnings, unsupported
1386c87b03e5SespieThese options all could have some relevant meaning for
1387c87b03e5SespieGNU Fortran programs, but are not yet supported.
1388c87b03e5Sespie@end table
1389c87b03e5Sespie
1390c87b03e5Sespie@node Debugging Options
1391c87b03e5Sespie@section Options for Debugging Your Program or GNU Fortran
1392c87b03e5Sespie@cindex options, debugging
1393c87b03e5Sespie@cindex debugging information options
1394c87b03e5Sespie
1395c87b03e5SespieGNU Fortran has various special options that are used for debugging
1396c87b03e5Sespieeither your program or @command{g77}
1397c87b03e5Sespie
1398c87b03e5Sespie@table @gcctabopt
1399c87b03e5Sespie@cindex -g option
1400c87b03e5Sespie@cindex options, -g
1401c87b03e5Sespie@item -g
1402c87b03e5SespieProduce debugging information in the operating system's native format
1403c87b03e5Sespie(stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
1404c87b03e5Sespieinformation.
1405c87b03e5Sespie
1406c87b03e5SespieA sample debugging session looks like this (note the use of the breakpoint):
1407c87b03e5Sespie@smallexample
1408c87b03e5Sespie$ cat gdb.f
1409c87b03e5Sespie      PROGRAM PROG
1410c87b03e5Sespie      DIMENSION A(10)
1411c87b03e5Sespie      DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./
1412c87b03e5Sespie      A(5) = 4.
1413c87b03e5Sespie      PRINT*,A
1414c87b03e5Sespie      END
1415c87b03e5Sespie$ g77 -g -O gdb.f
1416c87b03e5Sespie$ gdb a.out
1417c87b03e5Sespie...
1418c87b03e5Sespie(gdb) break MAIN__
1419c87b03e5SespieBreakpoint 1 at 0x8048e96: file gdb.f, line 4.
1420c87b03e5Sespie(gdb) run
1421c87b03e5SespieStarting program: /home/toon/g77-bugs/./a.out
1422c87b03e5SespieBreakpoint 1, MAIN__ () at gdb.f:4
1423c87b03e5Sespie4             A(5) = 4.
1424c87b03e5SespieCurrent language:  auto; currently fortran
1425c87b03e5Sespie(gdb) print a(5)
1426c87b03e5Sespie$1 = 5
1427c87b03e5Sespie(gdb) step
1428c87b03e5Sespie5             PRINT*,A
1429c87b03e5Sespie(gdb) print a(5)
1430c87b03e5Sespie$2 = 4
1431c87b03e5Sespie...
1432c87b03e5Sespie@end smallexample
1433c87b03e5SespieOne could also add the setting of the breakpoint and the first run command
1434c87b03e5Sespieto the file @file{.gdbinit} in the current directory, to simplify the debugging
1435c87b03e5Sespiesession.
1436c87b03e5Sespie@end table
1437c87b03e5Sespie
1438c87b03e5Sespie@xref{Debugging Options,,Options for Debugging Your Program or GCC,
1439c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for more information on
1440c87b03e5Sespiedebugging options.
1441c87b03e5Sespie
1442c87b03e5Sespie@node Optimize Options
1443c87b03e5Sespie@section Options That Control Optimization
1444c87b03e5Sespie@cindex optimize options
1445c87b03e5Sespie@cindex options, optimization
1446c87b03e5Sespie
1447c87b03e5SespieMost Fortran users will want to use no optimization when
1448c87b03e5Sespiedeveloping and testing programs, and use @option{-O} or @option{-O2} when
1449c87b03e5Sespiecompiling programs for late-cycle testing and for production use.
1450c87b03e5SespieHowever, note that certain diagnostics---such as for uninitialized
1451c87b03e5Sespievariables---depend on the flow analysis done by @option{-O}, i.e.@: you
1452c87b03e5Sespiemust use @option{-O} or @option{-O2} to get such diagnostics.
1453c87b03e5Sespie
1454c87b03e5SespieThe following flags have particular applicability when
1455c87b03e5Sespiecompiling Fortran programs:
1456c87b03e5Sespie
1457c87b03e5Sespie@table @gcctabopt
1458c87b03e5Sespie@cindex -malign-double option
1459c87b03e5Sespie@cindex options, -malign-double
1460c87b03e5Sespie@item -malign-double
1461c87b03e5Sespie(Intel x86 architecture only.)
1462c87b03e5Sespie
1463c87b03e5SespieNoticeably improves performance of @command{g77} programs making
1464c87b03e5Sespieheavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data
1465c87b03e5Sespieon some systems.
1466c87b03e5SespieIn particular, systems using Pentium, Pentium Pro, 586, and
1467c87b03e5Sespie686 implementations
1468c87b03e5Sespieof the i386 architecture execute programs faster when
1469c87b03e5Sespie@code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are
1470c87b03e5Sespiealigned on 64-bit boundaries
1471c87b03e5Sespiein memory.
1472c87b03e5Sespie
1473c87b03e5SespieThis option can, at least, make benchmark results more consistent
1474c87b03e5Sespieacross various system configurations, versions of the program,
1475c87b03e5Sespieand data sets.
1476c87b03e5Sespie
1477c87b03e5Sespie@emph{Note:} The warning in the @command{gcc} documentation about
1478c87b03e5Sespiethis option does not apply, generally speaking, to Fortran
1479c87b03e5Sespiecode compiled by @command{g77}
1480c87b03e5Sespie
1481c87b03e5Sespie@xref{Aligned Data}, for more information on alignment issues.
1482c87b03e5Sespie
1483c87b03e5Sespie@emph{Also also note:} The negative form of @option{-malign-double}
1484c87b03e5Sespieis @option{-mno-align-double}, not @option{-benign-double}.
1485c87b03e5Sespie
1486c87b03e5Sespie@cindex -ffloat-store option
1487c87b03e5Sespie@cindex options, -ffloat-store
1488c87b03e5Sespie@item -ffloat-store
1489c87b03e5Sespie@cindex IEEE 754 conformance
1490c87b03e5Sespie@cindex conformance, IEEE 754
1491c87b03e5Sespie@cindex floating-point, precision
1492c87b03e5SespieMight help a Fortran program that depends on exact IEEE conformance on
1493c87b03e5Sespiesome machines, but might slow down a program that doesn't.
1494c87b03e5Sespie
1495c87b03e5SespieThis option is effective when the floating-point unit is set to work in
1496c87b03e5SespieIEEE 854 `extended precision'---as it typically is on x86 and m68k GNU
1497c87b03e5Sespiesystems---rather than IEEE 754 double precision.  @option{-ffloat-store}
1498c87b03e5Sespietries to remove the extra precision by spilling data from floating-point
1499c87b03e5Sespieregisters into memory and this typically involves a big performance
1500c87b03e5Sespiehit.  However, it doesn't affect intermediate results, so that it is
1501c87b03e5Sespieonly partially effective.  `Excess precision' is avoided in code like:
1502c87b03e5Sespie@smallexample
1503c87b03e5Sespiea = b + c
1504c87b03e5Sespied = a * e
1505c87b03e5Sespie@end smallexample
1506c87b03e5Sespiebut not in code like:
1507c87b03e5Sespie@smallexample
1508c87b03e5Sespie      d = (b + c) * e
1509c87b03e5Sespie@end smallexample
1510c87b03e5Sespie
1511c87b03e5SespieFor another, potentially better, way of controlling the precision,
1512c87b03e5Sespiesee @ref{Floating-point precision}.
1513c87b03e5Sespie
1514c87b03e5Sespie@cindex -fforce-mem option
1515c87b03e5Sespie@cindex options, -fforce-mem
1516c87b03e5Sespie@item -fforce-mem
1517c87b03e5Sespie@cindex -fforce-addr option
1518c87b03e5Sespie@cindex options, -fforce-addr
1519c87b03e5Sespie@item -fforce-addr
1520c87b03e5Sespie@cindex loops, speeding up
1521c87b03e5Sespie@cindex speed, of loops
1522c87b03e5SespieMight improve optimization of loops.
1523c87b03e5Sespie
1524c87b03e5Sespie@cindex -fno-inline option
1525c87b03e5Sespie@cindex options, -fno-inline
1526c87b03e5Sespie@item -fno-inline
1527c87b03e5Sespie@cindex in-line code
1528c87b03e5Sespie@cindex compilation, in-line
1529c87b03e5Sespie@c DL: Only relevant for -O3? TM: No, statement functions are
1530c87b03e5Sespie@c inlined even at -O1.
1531c87b03e5SespieDon't compile statement functions inline.
1532c87b03e5SespieMight reduce the size of a program unit---which might be at
1533c87b03e5Sespieexpense of some speed (though it should compile faster).
1534c87b03e5SespieNote that if you are not optimizing, no functions can be expanded inline.
1535c87b03e5Sespie
1536c87b03e5Sespie@cindex -ffast-math option
1537c87b03e5Sespie@cindex options, -ffast-math
1538c87b03e5Sespie@item -ffast-math
1539c87b03e5Sespie@cindex IEEE 754 conformance
1540c87b03e5Sespie@cindex conformance, IEEE 754
1541c87b03e5SespieMight allow some programs designed to not be too dependent
1542c87b03e5Sespieon IEEE behavior for floating-point to run faster, or die trying.
1543c87b03e5SespieSets @option{-funsafe-math-optimizations}, @option{-ffinite-math-only},
1544c87b03e5Sespieand @option{-fno-trapping-math}.
1545c87b03e5Sespie
1546c87b03e5Sespie@cindex -funsafe-math-optimizations option
1547c87b03e5Sespie@cindex options, -funsafe-math-optimizations
1548c87b03e5Sespie@item -funsafe-math-optimizations
1549c87b03e5SespieAllow optimizations that may be give incorrect results
1550c87b03e5Sespiefor certain IEEE inputs.
1551c87b03e5Sespie
1552c87b03e5Sespie@cindex -ffinite-math-only option
1553c87b03e5Sespie@cindex options, -ffinite-math-only
1554c87b03e5Sespie@item -ffinite-math-only
1555c87b03e5SespieAllow optimizations for floating-point arithmetic that assume
1556c87b03e5Sespiethat arguments and results are not NaNs or +-Infs.
1557c87b03e5Sespie
1558c87b03e5SespieThis option should never be turned on by any @option{-O} option since
1559c87b03e5Sespieit can result in incorrect output for programs which depend on
1560c87b03e5Sespiean exact implementation of IEEE or ISO rules/specifications.
1561c87b03e5Sespie
1562c87b03e5SespieThe default is @option{-fno-finite-math-only}.
1563c87b03e5Sespie
1564c87b03e5Sespie@cindex -fno-trapping-math option
1565c87b03e5Sespie@cindex options, -fno-trapping-math
1566c87b03e5Sespie@item -fno-trapping-math
1567c87b03e5SespieAllow the compiler to assume that floating-point arithmetic
1568c87b03e5Sespiewill not generate traps on any inputs.  This is useful, for
1569c87b03e5Sespieexample, when running a program using IEEE "non-stop"
1570c87b03e5Sespiefloating-point arithmetic.
1571c87b03e5Sespie
1572c87b03e5Sespie@cindex -fstrength-reduce option
1573c87b03e5Sespie@cindex options, -fstrength-reduce
1574c87b03e5Sespie@item -fstrength-reduce
1575c87b03e5Sespie@cindex loops, speeding up
1576c87b03e5Sespie@cindex speed, of loops
1577c87b03e5Sespie@c DL: normally defaulted?
1578c87b03e5SespieMight make some loops run faster.
1579c87b03e5Sespie
1580c87b03e5Sespie@cindex -frerun-cse-after-loop option
1581c87b03e5Sespie@cindex options, -frerun-cse-after-loop
1582c87b03e5Sespie@item -frerun-cse-after-loop
1583c87b03e5Sespie@cindex -fexpensive-optimizations option
1584c87b03e5Sespie@cindex options, -fexpensive-optimizations
1585c87b03e5Sespie@c DL: This is -O2?
1586c87b03e5Sespie@item -fexpensive-optimizations
1587c87b03e5Sespie@cindex -fdelayed-branch option
1588c87b03e5Sespie@cindex options, -fdelayed-branch
1589c87b03e5Sespie@item -fdelayed-branch
1590c87b03e5Sespie@cindex -fschedule-insns option
1591c87b03e5Sespie@cindex options, -fschedule-insns
1592c87b03e5Sespie@item -fschedule-insns
1593c87b03e5Sespie@cindex -fschedule-insns2 option
1594c87b03e5Sespie@cindex options, -fschedule-insns2
1595c87b03e5Sespie@item -fschedule-insns2
1596c87b03e5Sespie@cindex -fcaller-saves option
1597c87b03e5Sespie@cindex options, -fcaller-saves
1598c87b03e5Sespie@item -fcaller-saves
1599c87b03e5SespieMight improve performance on some code.
1600c87b03e5Sespie
1601c87b03e5Sespie@cindex -funroll-loops option
1602c87b03e5Sespie@cindex options, -funroll-loops
1603c87b03e5Sespie@item -funroll-loops
1604c87b03e5Sespie@cindex loops, unrolling
1605c87b03e5Sespie@cindex unrolling loops
1606c87b03e5Sespie@cindex loops, optimizing
1607c87b03e5Sespie@cindex indexed (iterative) @code{DO}
1608c87b03e5Sespie@cindex iterative @code{DO}
1609c87b03e5Sespie@c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to
1610c87b03e5Sespie@c provide a suitable term
1611c87b03e5Sespie@c CB: I've decided on `iterative', for the time being, and changed
1612c87b03e5Sespie@c my previous, rather bizarre, use of `imperative' to that
1613c87b03e5Sespie@c (though `precomputed-trip' would be a more precise adjective)
1614c87b03e5SespieTypically improves performance on code using iterative @code{DO} loops by
1615c87b03e5Sespieunrolling them and is probably generally appropriate for Fortran, though
1616c87b03e5Sespieit is not turned on at any optimization level.
1617c87b03e5SespieNote that outer loop unrolling isn't done specifically; decisions about
1618c87b03e5Sespiewhether to unroll a loop are made on the basis of its instruction count.
1619c87b03e5Sespie
1620c87b03e5Sespie@c DL: Fixme: This should obviously go somewhere else...
1621c87b03e5SespieAlso, no `loop discovery'@footnote{@dfn{loop discovery} refers to the
1622c87b03e5Sespieprocess by which a compiler, or indeed any reader of a program,
1623c87b03e5Sespiedetermines which portions of the program are more likely to be executed
1624c87b03e5Sespierepeatedly as it is being run.  Such discovery typically is done early
1625c87b03e5Sespiewhen compiling using optimization techniques, so the ``discovered''
1626c87b03e5Sespieloops get more attention---and more run-time resources, such as
1627c87b03e5Sespieregisters---from the compiler.  It is easy to ``discover'' loops that are
1628c87b03e5Sespieconstructed out of looping constructs in the language
1629c87b03e5Sespie(such as Fortran's @code{DO}).  For some programs, ``discovering'' loops
1630c87b03e5Sespieconstructed out of lower-level constructs (such as @code{IF} and
1631c87b03e5Sespie@code{GOTO}) can lead to generation of more optimal code
1632c87b03e5Sespiethan otherwise.} is done, so only loops written with @code{DO}
1633c87b03e5Sespiebenefit from loop optimizations, including---but not limited
1634c87b03e5Sespieto---unrolling.  Loops written with @code{IF} and @code{GOTO} are not
1635c87b03e5Sespiecurrently recognized as such.  This option unrolls only iterative
1636c87b03e5Sespie@code{DO} loops, not @code{DO WHILE} loops.
1637c87b03e5Sespie
1638c87b03e5Sespie@cindex -funroll-all-loops option
1639c87b03e5Sespie@cindex options, -funroll-all-loops
1640c87b03e5Sespie@cindex DO WHILE
1641c87b03e5Sespie@item -funroll-all-loops
1642c87b03e5Sespie@c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct.
1643c87b03e5SespieProbably improves performance on code using @code{DO WHILE} loops by
1644c87b03e5Sespieunrolling them in addition to iterative @code{DO} loops.  In the absence
1645c87b03e5Sespieof @code{DO WHILE}, this option is equivalent to @option{-funroll-loops}
1646c87b03e5Sespiebut possibly slower.
1647c87b03e5Sespie
1648c87b03e5Sespie@item -fno-move-all-movables
1649c87b03e5Sespie@cindex -fno-move-all-movables option
1650c87b03e5Sespie@cindex options, -fno-move-all-movables
1651c87b03e5Sespie@item -fno-reduce-all-givs
1652c87b03e5Sespie@cindex -fno-reduce-all-givs option
1653c87b03e5Sespie@cindex options, -fno-reduce-all-givs
1654c87b03e5Sespie@item -fno-rerun-loop-opt
1655c87b03e5Sespie@cindex -fno-rerun-loop-opt option
1656c87b03e5Sespie@cindex options, -fno-rerun-loop-opt
1657c87b03e5SespieIn general, the optimizations enabled with these options will lead to
1658c87b03e5Sespiefaster code being generated by GNU Fortran; hence they are enabled by default
1659c87b03e5Sespiewhen issuing the @command{g77} command.
1660c87b03e5Sespie
1661c87b03e5Sespie@option{-fmove-all-movables} and @option{-freduce-all-givs} will enable
1662c87b03e5Sespieloop optimization to move all loop-invariant index computations in nested
1663c87b03e5Sespieloops over multi-rank array dummy arguments out of these loops.
1664c87b03e5Sespie
1665c87b03e5Sespie@option{-frerun-loop-opt} will move offset calculations resulting
1666c87b03e5Sespiefrom the fact that Fortran arrays by default have a lower bound of 1
1667c87b03e5Sespieout of the loops.
1668c87b03e5Sespie
1669c87b03e5SespieThese three options are intended to be removed someday, once
1670c87b03e5Sespieloop optimization is sufficiently advanced to perform all those
1671c87b03e5Sespietransformations without help from these options.
1672c87b03e5Sespie@end table
1673c87b03e5Sespie
1674c87b03e5Sespie@xref{Optimize Options,,Options That Control Optimization,
1675c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for more information on options
1676c87b03e5Sespieto optimize the generated machine code.
1677c87b03e5Sespie
1678c87b03e5Sespie@node Preprocessor Options
1679c87b03e5Sespie@section Options Controlling the Preprocessor
1680c87b03e5Sespie@cindex preprocessor options
1681c87b03e5Sespie@cindex options, preprocessor
1682c87b03e5Sespie@cindex cpp program
1683c87b03e5Sespie@cindex programs, cpp
1684c87b03e5Sespie
1685c87b03e5SespieThese options control the C preprocessor, which is run on each C source
1686c87b03e5Sespiefile before actual compilation.
1687c87b03e5Sespie
1688c87b03e5Sespie@xref{Preprocessor Options,,Options Controlling the Preprocessor,
1689c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information on C
1690c87b03e5Sespiepreprocessor options.
1691c87b03e5Sespie
1692c87b03e5Sespie@cindex INCLUDE directive
1693c87b03e5Sespie@cindex directive, INCLUDE
1694c87b03e5SespieSome of these options also affect how @command{g77} processes the
1695c87b03e5Sespie@code{INCLUDE} directive.
1696c87b03e5SespieSince this directive is processed even when preprocessing
1697c87b03e5Sespieis not requested, it is not described in this section.
1698c87b03e5Sespie@xref{Directory Options,,Options for Directory Search}, for
1699c87b03e5Sespieinformation on how @command{g77} processes the @code{INCLUDE} directive.
1700c87b03e5Sespie
1701c87b03e5SespieHowever, the @code{INCLUDE} directive does not apply
1702c87b03e5Sespiepreprocessing to the contents of the included file itself.
1703c87b03e5Sespie
1704c87b03e5SespieTherefore, any file that contains preprocessor directives
1705c87b03e5Sespie(such as @code{#include}, @code{#define}, and @code{#if})
1706c87b03e5Sespiemust be included via the @code{#include} directive, not
1707c87b03e5Sespievia the @code{INCLUDE} directive.
1708c87b03e5SespieTherefore, any file containing preprocessor directives,
1709c87b03e5Sespieif included, is necessarily included by a file that itself
1710c87b03e5Sespiecontains preprocessor directives.
1711c87b03e5Sespie
1712c87b03e5Sespie@node Directory Options
1713c87b03e5Sespie@section Options for Directory Search
1714c87b03e5Sespie@cindex directory, options
1715c87b03e5Sespie@cindex options, directory search
1716c87b03e5Sespie@cindex search path
1717c87b03e5Sespie
1718c87b03e5SespieThese options affect how the @command{cpp} preprocessor searches
1719c87b03e5Sespiefor files specified via the @code{#include} directive.
1720c87b03e5SespieTherefore, when compiling Fortran programs, they are meaningful
1721c87b03e5Sespiewhen the preprocessor is used.
1722c87b03e5Sespie
1723c87b03e5Sespie@cindex INCLUDE directive
1724c87b03e5Sespie@cindex directive, INCLUDE
1725c87b03e5SespieSome of these options also affect how @command{g77} searches
1726c87b03e5Sespiefor files specified via the @code{INCLUDE} directive,
1727c87b03e5Sespiealthough files included by that directive are not,
1728c87b03e5Sespiethemselves, preprocessed.
1729c87b03e5SespieThese options are:
1730c87b03e5Sespie
1731c87b03e5Sespie@table @gcctabopt
1732c87b03e5Sespie@cindex -I- option
1733c87b03e5Sespie@cindex options, -I-
1734c87b03e5Sespie@item -I-
1735c87b03e5Sespie@cindex -Idir option
1736c87b03e5Sespie@cindex options, -Idir
1737c87b03e5Sespie@item -I@var{dir}
1738c87b03e5Sespie@cindex directory, search paths for inclusion
1739c87b03e5Sespie@cindex inclusion, directory search paths for
1740c87b03e5Sespie@cindex search paths, for included files
1741c87b03e5Sespie@cindex paths, search
1742c87b03e5SespieThese affect interpretation of the @code{INCLUDE} directive
1743c87b03e5Sespie(as well as of the @code{#include} directive of the @command{cpp}
1744c87b03e5Sespiepreprocessor).
1745c87b03e5Sespie
1746c87b03e5SespieNote that @option{-I@var{dir}} must be specified @emph{without} any
1747c87b03e5Sespiespaces between @option{-I} and the directory name---that is,
1748c87b03e5Sespie@option{-Ifoo/bar} is valid, but @option{-I foo/bar}
1749c87b03e5Sespieis rejected by the @command{g77} compiler (though the preprocessor supports
1750c87b03e5Sespiethe latter form).
1751c87b03e5Sespie@c this is due to toplev.c's inflexible option processing
1752c87b03e5SespieAlso note that the general behavior of @option{-I} and
1753c87b03e5Sespie@code{INCLUDE} is pretty much the same as of @option{-I} with
1754c87b03e5Sespie@code{#include} in the @command{cpp} preprocessor, with regard to
1755c87b03e5Sespielooking for @file{header.gcc} files and other such things.
1756c87b03e5Sespie
1757c87b03e5Sespie@xref{Directory Options,,Options for Directory Search,
1758c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information on the
1759c87b03e5Sespie@option{-I} option.
1760c87b03e5Sespie@end table
1761c87b03e5Sespie
1762c87b03e5Sespie@node Code Gen Options
1763c87b03e5Sespie@section Options for Code Generation Conventions
1764c87b03e5Sespie@cindex code generation, conventions
1765c87b03e5Sespie@cindex options, code generation
1766c87b03e5Sespie@cindex run-time, options
1767c87b03e5Sespie
1768c87b03e5SespieThese machine-independent options control the interface conventions
1769c87b03e5Sespieused in code generation.
1770c87b03e5Sespie
1771c87b03e5SespieMost of them have both positive and negative forms; the negative form
1772c87b03e5Sespieof @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
1773c87b03e5Sespieone of the forms is listed---the one which is not the default.  You
1774c87b03e5Sespiecan figure out the other form by either removing @option{no-} or adding
1775c87b03e5Sespieit.
1776c87b03e5Sespie
1777c87b03e5Sespie@table @gcctabopt
1778c87b03e5Sespie@cindex -fno-automatic option
1779c87b03e5Sespie@cindex options, -fno-automatic
1780c87b03e5Sespie@item -fno-automatic
1781c87b03e5Sespie@cindex SAVE statement
1782c87b03e5Sespie@cindex statements, SAVE
1783c87b03e5SespieTreat each program unit as if the @code{SAVE} statement was specified
1784c87b03e5Sespiefor every local variable and array referenced in it.
1785c87b03e5SespieDoes not affect common blocks.
1786c87b03e5Sespie(Some Fortran compilers provide this option under
1787c87b03e5Sespiethe name @option{-static}.)
1788c87b03e5Sespie
1789c87b03e5Sespie@cindex -finit-local-zero option
1790c87b03e5Sespie@cindex options, -finit-local-zero
1791c87b03e5Sespie@item -finit-local-zero
1792c87b03e5Sespie@cindex DATA statement
1793c87b03e5Sespie@cindex statements, DATA
1794c87b03e5Sespie@cindex initialization, of local variables
1795c87b03e5Sespie@cindex variables, initialization of
1796c87b03e5Sespie@cindex uninitialized variables
1797c87b03e5Sespie@cindex variables, uninitialized
1798c87b03e5SespieSpecify that variables and arrays that are local to a program unit
1799c87b03e5Sespie(not in a common block and not passed as an argument) are to be initialized
1800c87b03e5Sespieto binary zeros.
1801c87b03e5Sespie
1802c87b03e5SespieSince there is a run-time penalty for initialization of variables
1803c87b03e5Sespiethat are not given the @code{SAVE} attribute, it might be a
1804c87b03e5Sespiegood idea to also use @option{-fno-automatic} with @option{-finit-local-zero}.
1805c87b03e5Sespie
1806c87b03e5Sespie@cindex -fno-f2c option
1807c87b03e5Sespie@cindex options, -fno-f2c
1808c87b03e5Sespie@item -fno-f2c
1809c87b03e5Sespie@cindex @command{f2c} compatibility
1810c87b03e5Sespie@cindex compatibility, @command{f2c}
1811c87b03e5SespieDo not generate code designed to be compatible with code generated
1812c87b03e5Sespieby @command{f2c} use the GNU calling conventions instead.
1813c87b03e5Sespie
1814c87b03e5SespieThe @command{f2c} calling conventions require functions that return
1815c87b03e5Sespietype @code{REAL(KIND=1)} to actually return the C type @code{double},
1816c87b03e5Sespieand functions that return type @code{COMPLEX} to return the
1817c87b03e5Sespievalues via an extra argument in the calling sequence that points
1818c87b03e5Sespieto where to store the return value.
1819c87b03e5SespieUnder the GNU calling conventions, such functions simply return
1820c87b03e5Sespietheir results as they would in GNU C---@code{REAL(KIND=1)} functions
1821c87b03e5Sespiereturn the C type @code{float}, and @code{COMPLEX} functions
1822c87b03e5Sespiereturn the GNU C type @code{complex} (or its @code{struct}
1823c87b03e5Sespieequivalent).
1824c87b03e5Sespie
1825c87b03e5SespieThis does not affect the generation of code that interfaces with the
1826c87b03e5Sespie@code{libg2c} library.
1827c87b03e5Sespie
1828c87b03e5SespieHowever, because the @code{libg2c} library uses @command{f2c}
1829c87b03e5Sespiecalling conventions, @command{g77} rejects attempts to pass
1830c87b03e5Sespieintrinsics implemented by routines in this library as actual
1831c87b03e5Sespiearguments when @option{-fno-f2c} is used, to avoid bugs when
1832c87b03e5Sespiethey are actually called by code expecting the GNU calling
1833c87b03e5Sespieconventions to work.
1834c87b03e5Sespie
1835c87b03e5SespieFor example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is
1836c87b03e5Sespierejected when @option{-fno-f2c} is in force.
1837c87b03e5Sespie(Future versions of the @command{g77} run-time library might
1838c87b03e5Sespieoffer routines that provide GNU-callable versions of the
1839c87b03e5Sespieroutines that implement the @command{f2c} intrinsics
1840c87b03e5Sespiethat may be passed as actual arguments, so that
1841c87b03e5Sespievalid programs need not be rejected when @option{-fno-f2c}
1842c87b03e5Sespieis used.)
1843c87b03e5Sespie
1844c87b03e5Sespie@strong{Caution:} If @option{-fno-f2c} is used when compiling any
1845c87b03e5Sespiesource file used in a program, it must be used when compiling
1846c87b03e5Sespie@emph{all} Fortran source files used in that program.
1847c87b03e5Sespie
1848c87b03e5Sespie@c seems kinda dumb to tell people about an option they can't use -- jcb
1849c87b03e5Sespie@c then again, we want users building future-compatible libraries with it.
1850c87b03e5Sespie@cindex -ff2c-library option
1851c87b03e5Sespie@cindex options, -ff2c-library
1852c87b03e5Sespie@item -ff2c-library
1853c87b03e5SespieSpecify that use of @code{libg2c} (or the original @code{libf2c})
1854c87b03e5Sespieis required.
1855c87b03e5SespieThis is the default for the current version of @command{g77}
1856c87b03e5Sespie
1857c87b03e5SespieCurrently it is not
1858c87b03e5Sespievalid to specify @option{-fno-f2c-library}.
1859c87b03e5SespieThis option is provided so users can specify it in shell
1860c87b03e5Sespiescripts that build programs and libraries that require the
1861c87b03e5Sespie@code{libf2c} library, even when being compiled by future
1862c87b03e5Sespieversions of @command{g77} that might otherwise default to
1863c87b03e5Sespiegenerating code for an incompatible library.
1864c87b03e5Sespie
1865c87b03e5Sespie@cindex -fno-underscoring option
1866c87b03e5Sespie@cindex options, -fno-underscoring
1867c87b03e5Sespie@item -fno-underscoring
1868c87b03e5Sespie@cindex underscore
1869c87b03e5Sespie@cindex symbol names, underscores
1870c87b03e5Sespie@cindex transforming symbol names
1871c87b03e5Sespie@cindex symbol names, transforming
1872c87b03e5SespieDo not transform names of entities specified in the Fortran
1873c87b03e5Sespiesource file by appending underscores to them.
1874c87b03e5Sespie
1875c87b03e5SespieWith @option{-funderscoring} in effect, @command{g77} appends two underscores
1876c87b03e5Sespieto names with underscores and one underscore to external names with
1877c87b03e5Sespieno underscores.  (@command{g77} also appends two underscores to internal
1878c87b03e5Sespienames with underscores to avoid naming collisions with external names.
1879c87b03e5SespieThe @option{-fno-second-underscore} option disables appending of the
1880c87b03e5Sespiesecond underscore in all cases.)
1881c87b03e5Sespie
1882c87b03e5SespieThis is done to ensure compatibility with code produced by many
1883c87b03e5SespieUNIX Fortran compilers, including @command{f2c} which perform the
1884c87b03e5Sespiesame transformations.
1885c87b03e5Sespie
1886c87b03e5SespieUse of @option{-fno-underscoring} is not recommended unless you are
1887c87b03e5Sespieexperimenting with issues such as integration of (GNU) Fortran into
1888c87b03e5Sespieexisting system environments (vis-a-vis existing libraries, tools, and
1889c87b03e5Sespieso on).
1890c87b03e5Sespie
1891c87b03e5SespieFor example, with @option{-funderscoring}, and assuming other defaults like
1892c87b03e5Sespie@option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
1893c87b03e5Sespieexternal functions while @samp{my_var} and @samp{lvar} are local variables,
1894c87b03e5Sespiea statement like
1895c87b03e5Sespie
1896c87b03e5Sespie@smallexample
1897c87b03e5SespieI = J() + MAX_COUNT (MY_VAR, LVAR)
1898c87b03e5Sespie@end smallexample
1899c87b03e5Sespie
1900c87b03e5Sespie@noindent
1901c87b03e5Sespieis implemented as something akin to:
1902c87b03e5Sespie
1903c87b03e5Sespie@smallexample
1904c87b03e5Sespiei = j_() + max_count__(&my_var__, &lvar);
1905c87b03e5Sespie@end smallexample
1906c87b03e5Sespie
1907c87b03e5SespieWith @option{-fno-underscoring}, the same statement is implemented as:
1908c87b03e5Sespie
1909c87b03e5Sespie@smallexample
1910c87b03e5Sespiei = j() + max_count(&my_var, &lvar);
1911c87b03e5Sespie@end smallexample
1912c87b03e5Sespie
1913c87b03e5SespieUse of @option{-fno-underscoring} allows direct specification of
1914c87b03e5Sespieuser-defined names while debugging and when interfacing @command{g77}
1915c87b03e5Sespiecode with other languages.
1916c87b03e5Sespie
1917c87b03e5SespieNote that just because the names match does @emph{not} mean that the
1918c87b03e5Sespieinterface implemented by @command{g77} for an external name matches the
1919c87b03e5Sespieinterface implemented by some other language for that same name.
1920c87b03e5SespieThat is, getting code produced by @command{g77} to link to code produced
1921c87b03e5Sespieby some other compiler using this or any other method can be only a
1922c87b03e5Sespiesmall part of the overall solution---getting the code generated by
1923c87b03e5Sespieboth compilers to agree on issues other than naming can require
1924c87b03e5Sespiesignificant effort, and, unlike naming disagreements, linkers normally
1925c87b03e5Sespiecannot detect disagreements in these other areas.
1926c87b03e5Sespie
1927c87b03e5SespieAlso, note that with @option{-fno-underscoring}, the lack of appended
1928c87b03e5Sespieunderscores introduces the very real possibility that a user-defined
1929c87b03e5Sespieexternal name will conflict with a name in a system library, which
1930c87b03e5Sespiecould make finding unresolved-reference bugs quite difficult in some
1931c87b03e5Sespiecases---they might occur at program run time, and show up only as
1932c87b03e5Sespiebuggy behavior at run time.
1933c87b03e5Sespie
1934c87b03e5SespieIn future versions of @command{g77} we hope to improve naming and linking
1935c87b03e5Sespieissues so that debugging always involves using the names as they appear
1936c87b03e5Sespiein the source, even if the names as seen by the linker are mangled to
1937c87b03e5Sespieprevent accidental linking between procedures with incompatible
1938c87b03e5Sespieinterfaces.
1939c87b03e5Sespie
1940c87b03e5Sespie@cindex -fno-second-underscore option
1941c87b03e5Sespie@cindex options, -fno-second-underscore
1942c87b03e5Sespie@item -fno-second-underscore
1943c87b03e5Sespie@cindex underscore
1944c87b03e5Sespie@cindex symbol names, underscores
1945c87b03e5Sespie@cindex transforming symbol names
1946c87b03e5Sespie@cindex symbol names, transforming
1947c87b03e5SespieDo not append a second underscore to names of entities specified
1948c87b03e5Sespiein the Fortran source file.
1949c87b03e5Sespie
1950c87b03e5SespieThis option has no effect if @option{-fno-underscoring} is
1951c87b03e5Sespiein effect.
1952c87b03e5Sespie
1953c87b03e5SespieOtherwise, with this option, an external name such as @samp{MAX_COUNT}
1954c87b03e5Sespieis implemented as a reference to the link-time external symbol
1955c87b03e5Sespie@samp{max_count_}, instead of @samp{max_count__}.
1956c87b03e5Sespie
1957c87b03e5Sespie@cindex -fno-ident option
1958c87b03e5Sespie@cindex options, -fno-ident
1959c87b03e5Sespie@item -fno-ident
1960c87b03e5SespieIgnore the @samp{#ident} directive.
1961c87b03e5Sespie
1962c87b03e5Sespie@cindex -fzeros option
1963c87b03e5Sespie@cindex options, -fzeros
1964c87b03e5Sespie@item -fzeros
1965c87b03e5SespieTreat initial values of zero as if they were any other value.
1966c87b03e5Sespie
1967c87b03e5SespieAs of version 0.5.18, @command{g77} normally treats @code{DATA} and
1968c87b03e5Sespieother statements that are used to specify initial values of zero
1969c87b03e5Sespiefor variables and arrays as if no values were actually specified,
1970c87b03e5Sespiein the sense that no diagnostics regarding multiple initializations
1971c87b03e5Sespieare produced.
1972c87b03e5Sespie
1973c87b03e5SespieThis is done to speed up compiling of programs that initialize
1974c87b03e5Sespielarge arrays to zeros.
1975c87b03e5Sespie
1976c87b03e5SespieUse @option{-fzeros} to revert to the simpler, slower behavior
1977c87b03e5Sespiethat can catch multiple initializations by keeping track of
1978c87b03e5Sespieall initializations, zero or otherwise.
1979c87b03e5Sespie
1980c87b03e5Sespie@emph{Caution:} Future versions of @command{g77} might disregard this option
1981c87b03e5Sespie(and its negative form, the default) or interpret it somewhat
1982c87b03e5Sespiedifferently.
1983c87b03e5SespieThe interpretation changes will affect only non-standard
1984c87b03e5Sespieprograms; standard-conforming programs should not be affected.
1985c87b03e5Sespie
1986c87b03e5Sespie@cindex -femulate-complex option
1987c87b03e5Sespie@cindex options, -femulate-complex
1988c87b03e5Sespie@item -femulate-complex
1989c87b03e5SespieImplement @code{COMPLEX} arithmetic via emulation,
1990c87b03e5Sespieinstead of using the facilities of
1991c87b03e5Sespiethe @command{gcc} back end that provide direct support of
1992c87b03e5Sespie@code{complex} arithmetic.
1993c87b03e5Sespie
1994c87b03e5Sespie(@command{gcc} had some bugs in its back-end support
1995c87b03e5Sespiefor @code{complex} arithmetic, due primarily to the support not being
1996c87b03e5Sespiecompleted as of version 2.8.1 and @code{egcs} 1.1.2.)
1997c87b03e5Sespie
1998c87b03e5SespieUse @option{-femulate-complex} if you suspect code-generation bugs,
1999c87b03e5Sespieor experience compiler crashes,
2000c87b03e5Sespiethat might result from @command{g77} using the @code{COMPLEX} support
2001c87b03e5Sespiein the @command{gcc} back end.
2002c87b03e5SespieIf using that option fixes the bugs or crashes you are seeing,
2003c87b03e5Sespiethat indicates a likely @command{g77} bugs
2004c87b03e5Sespie(though, all compiler crashes are considered bugs),
2005c87b03e5Sespieso, please report it.
2006c87b03e5Sespie(Note that the known bugs, now believed fixed, produced compiler crashes
2007c87b03e5Sespierather than causing the generation of incorrect code.)
2008c87b03e5Sespie
2009c87b03e5SespieUse of this option should not affect how Fortran code compiled
2010c87b03e5Sespieby @command{g77} works in terms of its interfaces to other code,
2011c87b03e5Sespiee.g. that compiled by @command{f2c}
2012c87b03e5Sespie
2013c87b03e5SespieAs of GCC version 3.0, this option is not necessary anymore.
2014c87b03e5Sespie
2015c87b03e5Sespie@emph{Caution:} Future versions of @command{g77} might ignore both forms
2016c87b03e5Sespieof this option.
2017c87b03e5Sespie
2018c87b03e5Sespie@cindex -falias-check option
2019c87b03e5Sespie@cindex options, -falias-check
2020c87b03e5Sespie@cindex -fargument-alias option
2021c87b03e5Sespie@cindex options, -fargument-alias
2022c87b03e5Sespie@cindex -fargument-noalias option
2023c87b03e5Sespie@cindex options, -fargument-noalias
2024c87b03e5Sespie@cindex -fno-argument-noalias-global option
2025c87b03e5Sespie@cindex options, -fno-argument-noalias-global
2026c87b03e5Sespie@item -falias-check
2027c87b03e5Sespie@item -fargument-alias
2028c87b03e5Sespie@item -fargument-noalias
2029c87b03e5Sespie@item -fno-argument-noalias-global
2030c87b03e5Sespie@emph{Version info:}
2031c87b03e5SespieThese options are not supported by
2032c87b03e5Sespieversions of @command{g77} based on @command{gcc} version 2.8.
2033c87b03e5Sespie
2034c87b03e5SespieThese options specify to what degree aliasing
2035c87b03e5Sespie(overlap)
2036c87b03e5Sespieis permitted between
2037c87b03e5Sespiearguments (passed as pointers) and @code{COMMON} (external, or
2038c87b03e5Sespiepublic) storage.
2039c87b03e5Sespie
2040c87b03e5SespieThe default for Fortran code, as mandated by the FORTRAN 77 and
2041c87b03e5SespieFortran 90 standards, is @option{-fargument-noalias-global}.
2042c87b03e5SespieThe default for code written in the C language family is
2043c87b03e5Sespie@option{-fargument-alias}.
2044c87b03e5Sespie
2045c87b03e5SespieNote that, on some systems, compiling with @option{-fforce-addr} in
2046c87b03e5Sespieeffect can produce more optimal code when the default aliasing
2047c87b03e5Sespieoptions are in effect (and when optimization is enabled).
2048c87b03e5Sespie
2049c87b03e5Sespie@xref{Aliasing Assumed To Work}, for detailed information on the implications
2050c87b03e5Sespieof compiling Fortran code that depends on the ability to alias dummy
2051c87b03e5Sespiearguments.
2052c87b03e5Sespie
2053c87b03e5Sespie@cindex -fno-globals option
2054c87b03e5Sespie@cindex options, -fno-globals
2055c87b03e5Sespie@item -fno-globals
2056c87b03e5Sespie@cindex global names, warning
2057c87b03e5Sespie@cindex warnings, global names
2058c87b03e5Sespie@cindex in-line code
2059c87b03e5Sespie@cindex compilation, in-line
2060c87b03e5SespieDisable diagnostics about inter-procedural
2061c87b03e5Sespieanalysis problems, such as disagreements about the
2062c87b03e5Sespietype of a function or a procedure's argument,
2063c87b03e5Sespiethat might cause a compiler crash when attempting
2064c87b03e5Sespieto inline a reference to a procedure within a
2065c87b03e5Sespieprogram unit.
2066c87b03e5Sespie(The diagnostics themselves are still produced, but
2067c87b03e5Sespieas warnings, unless @option{-Wno-globals} is specified,
2068c87b03e5Sespiein which case no relevant diagnostics are produced.)
2069c87b03e5Sespie
2070c87b03e5SespieFurther, this option disables such inlining, to
2071c87b03e5Sespieavoid compiler crashes resulting from incorrect
2072c87b03e5Sespiecode that would otherwise be diagnosed.
2073c87b03e5Sespie
2074c87b03e5SespieAs such, this option might be quite useful when
2075c87b03e5Sespiecompiling existing, ``working'' code that happens
2076c87b03e5Sespieto have a few bugs that do not generally show themselves,
2077c87b03e5Sespiebut which @command{g77} diagnoses.
2078c87b03e5Sespie
2079c87b03e5SespieUse of this option therefore has the effect of
2080c87b03e5Sespieinstructing @command{g77} to behave more like it did
2081c87b03e5Sespieup through version 0.5.19.1, when it paid little or
2082c87b03e5Sespieno attention to disagreements between program units
2083c87b03e5Sespieabout a procedure's type and argument information,
2084c87b03e5Sespieand when it performed no inlining of procedures
2085c87b03e5Sespie(except statement functions).
2086c87b03e5Sespie
2087c87b03e5SespieWithout this option, @command{g77} defaults to performing
2088c87b03e5Sespiethe potentially inlining procedures as it started doing
2089c87b03e5Sespiein version 0.5.20, but as of version 0.5.21, it also
2090c87b03e5Sespiediagnoses disagreements that might cause such inlining
2091c87b03e5Sespieto crash the compiler as (fatal) errors,
2092c87b03e5Sespieand warns about similar disagreements
2093c87b03e5Sespiethat are currently believed to not
2094c87b03e5Sespielikely to result in the compiler later crashing
2095c87b03e5Sespieor producing incorrect code.
2096c87b03e5Sespie
2097c87b03e5Sespie@cindex -fflatten-arrays option
2098c87b03e5Sespie@item -fflatten-arrays
2099c87b03e5Sespie@cindex array performance
2100c87b03e5Sespie@cindex arrays, flattening
2101c87b03e5SespieUse back end's C-like constructs
2102c87b03e5Sespie(pointer plus offset)
2103c87b03e5Sespieinstead of its @code{ARRAY_REF} construct
2104c87b03e5Sespieto handle all array references.
2105c87b03e5Sespie
2106c87b03e5Sespie@emph{Note:} This option is not supported.
2107c87b03e5SespieIt is intended for use only by @command{g77} developers,
2108c87b03e5Sespieto evaluate code-generation issues.
2109c87b03e5SespieIt might be removed at any time.
2110c87b03e5Sespie
2111c87b03e5Sespie@cindex -fbounds-check option
2112c87b03e5Sespie@cindex -ffortran-bounds-check option
2113c87b03e5Sespie@item -fbounds-check
2114c87b03e5Sespie@itemx -ffortran-bounds-check
2115c87b03e5Sespie@cindex bounds checking
2116c87b03e5Sespie@cindex range checking
2117c87b03e5Sespie@cindex array bounds checking
2118c87b03e5Sespie@cindex subscript checking
2119c87b03e5Sespie@cindex substring checking
2120c87b03e5Sespie@cindex checking subscripts
2121c87b03e5Sespie@cindex checking substrings
2122c87b03e5SespieEnable generation of run-time checks for array subscripts
2123c87b03e5Sespieand substring start and end points
2124c87b03e5Sespieagainst the (locally) declared minimum and maximum values.
2125c87b03e5Sespie
2126c87b03e5SespieThe current implementation uses the @code{libf2c}
2127c87b03e5Sespielibrary routine @code{s_rnge} to print the diagnostic.
2128c87b03e5Sespie
2129c87b03e5SespieHowever, whereas @command{f2c} generates a single check per
2130c87b03e5Sespiereference for a multi-dimensional array, of the computed
2131c87b03e5Sespieoffset against the valid offset range (0 through the size of the array),
2132c87b03e5Sespie@command{g77} generates a single check per @emph{subscript} expression.
2133c87b03e5SespieThis catches some cases of potential bugs that @command{f2c} does not,
2134c87b03e5Sespiesuch as references to below the beginning of an assumed-size array.
2135c87b03e5Sespie
2136c87b03e5Sespie@command{g77} also generates checks for @code{CHARACTER} substring references,
2137c87b03e5Sespiesomething @command{f2c} currently does not do.
2138c87b03e5Sespie
2139c87b03e5SespieUse the new @option{-ffortran-bounds-check} option
2140c87b03e5Sespieto specify bounds-checking for only the Fortran code you are compiling,
2141c87b03e5Sespienot necessarily for code written in other languages.
2142c87b03e5Sespie
2143c87b03e5Sespie@emph{Note:} To provide more detailed information on the offending subscript,
2144c87b03e5Sespie@command{g77} provides the @code{libg2c} run-time library routine @code{s_rnge}
2145c87b03e5Sespiewith somewhat differently-formatted information.
2146c87b03e5SespieHere's a sample diagnostic:
2147c87b03e5Sespie
2148c87b03e5Sespie@smallexample
2149c87b03e5SespieSubscript out of range on file line 4, procedure rnge.f/bf.
2150c87b03e5SespieAttempt to access the -6-th element of variable b[subscript-2-of-2].
2151c87b03e5SespieAborted
2152c87b03e5Sespie@end smallexample
2153c87b03e5Sespie
2154c87b03e5SespieThe above message indicates that the offending source line is
2155c87b03e5Sespieline 4 of the file @file{rnge.f},
2156c87b03e5Sespiewithin the program unit (or statement function) named @samp{bf}.
2157c87b03e5SespieThe offended array is named @samp{b}.
2158c87b03e5SespieThe offended array dimension is the second for a two-dimensional array,
2159c87b03e5Sespieand the offending, computed subscript expression was @samp{-6}.
2160c87b03e5Sespie
2161c87b03e5SespieFor a @code{CHARACTER} substring reference, the second line has
2162c87b03e5Sespiethis appearance:
2163c87b03e5Sespie
2164c87b03e5Sespie@smallexample
2165c87b03e5SespieAttempt to access the 11-th element of variable a[start-substring].
2166c87b03e5Sespie@end smallexample
2167c87b03e5Sespie
2168c87b03e5SespieThis indicates that the offended @code{CHARACTER} variable or array
2169c87b03e5Sespieis named @samp{a},
2170c87b03e5Sespiethe offended substring position is the starting (leftmost) position,
2171c87b03e5Sespieand the offending substring expression is @samp{11}.
2172c87b03e5Sespie
2173c87b03e5Sespie(Though the verbage of @code{s_rnge} is not ideal
2174c87b03e5Sespiefor the purpose of the @command{g77} compiler,
2175c87b03e5Sespiethe above information should provide adequate diagnostic abilities
2176c87b03e5Sespieto it users.)
2177c87b03e5Sespie@end table
2178c87b03e5Sespie
2179c87b03e5Sespie@xref{Code Gen Options,,Options for Code Generation Conventions,
2180c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information on more options
2181c87b03e5Sespieoffered by the GBE
2182c87b03e5Sespieshared by @command{g77} @command{gcc} and other GNU compilers.
2183c87b03e5Sespie
2184c87b03e5SespieSome of these do @emph{not} work when compiling programs written in Fortran:
2185c87b03e5Sespie
2186c87b03e5Sespie@table @gcctabopt
2187c87b03e5Sespie@cindex -fpcc-struct-return option
2188c87b03e5Sespie@cindex options, -fpcc-struct-return
2189c87b03e5Sespie@item -fpcc-struct-return
2190c87b03e5Sespie@cindex -freg-struct-return option
2191c87b03e5Sespie@cindex options, -freg-struct-return
2192c87b03e5Sespie@item -freg-struct-return
2193c87b03e5SespieYou should not use these except strictly the same way as you
2194c87b03e5Sespieused them to build the version of @code{libg2c} with which
2195c87b03e5Sespieyou will be linking all code compiled by @command{g77} with the
2196c87b03e5Sespiesame option.
2197c87b03e5Sespie
2198c87b03e5Sespie@cindex -fshort-double option
2199c87b03e5Sespie@cindex options, -fshort-double
2200c87b03e5Sespie@item -fshort-double
2201c87b03e5SespieThis probably either has no effect on Fortran programs, or
2202c87b03e5Sespiemakes them act loopy.
2203c87b03e5Sespie
2204c87b03e5Sespie@cindex -fno-common option
2205c87b03e5Sespie@cindex options, -fno-common
2206c87b03e5Sespie@item -fno-common
2207c87b03e5SespieDo not use this when compiling Fortran programs,
2208c87b03e5Sespieor there will be Trouble.
2209c87b03e5Sespie
2210c87b03e5Sespie@cindex -fpack-struct option
2211c87b03e5Sespie@cindex options, -fpack-struct
2212c87b03e5Sespie@item -fpack-struct
2213c87b03e5SespieThis probably will break any calls to the @code{libg2c} library,
2214c87b03e5Sespieat the very least, even if it is built with the same option.
2215c87b03e5Sespie@end table
2216c87b03e5Sespie
2217c87b03e5Sespie@c man end
2218c87b03e5Sespie
2219c87b03e5Sespie@node Environment Variables
2220c87b03e5Sespie@section Environment Variables Affecting GNU Fortran
2221c87b03e5Sespie@cindex environment variables
2222c87b03e5Sespie
2223c87b03e5Sespie@c man begin ENVIRONMENT
2224c87b03e5Sespie
2225c87b03e5SespieGNU Fortran currently does not make use of any environment
2226c87b03e5Sespievariables to control its operation above and beyond those
2227c87b03e5Sespiethat affect the operation of @command{gcc}.
2228c87b03e5Sespie
2229c87b03e5Sespie@xref{Environment Variables,,Environment Variables Affecting GCC,
2230c87b03e5Sespiegcc,Using the GNU Compiler Collection (GCC)}, for information on environment
2231c87b03e5Sespievariables.
2232c87b03e5Sespie
2233c87b03e5Sespie@c man end
2234