1 |
12 |
jlechner |
@c Copyright (C) 2004, 2005, 2006
|
2 |
|
|
@c Free Software Foundation, Inc.
|
3 |
|
|
@c This is part of the GFORTRAN manual.
|
4 |
|
|
@c For copying conditions, see the file gfortran.texi.
|
5 |
|
|
|
6 |
|
|
@ignore
|
7 |
|
|
@c man begin COPYRIGHT
|
8 |
|
|
Copyright @copyright{} 2004, 2005
|
9 |
|
|
Free Software Foundation, Inc.
|
10 |
|
|
|
11 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
12 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
13 |
|
|
any later version published by the Free Software Foundation; with the
|
14 |
|
|
Invariant Sections being ``GNU General Public License'' and ``Funding
|
15 |
|
|
Free Software'', the Front-Cover texts being (a) (see below), and with
|
16 |
|
|
the Back-Cover Texts being (b) (see below). A copy of the license is
|
17 |
|
|
included in the gfdl(7) man page.
|
18 |
|
|
|
19 |
|
|
(a) The FSF's Front-Cover Text is:
|
20 |
|
|
|
21 |
|
|
A GNU Manual
|
22 |
|
|
|
23 |
|
|
(b) The FSF's Back-Cover Text is:
|
24 |
|
|
|
25 |
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
26 |
|
|
software. Copies published by the Free Software Foundation raise
|
27 |
|
|
funds for GNU development.
|
28 |
|
|
@c man end
|
29 |
|
|
@c Set file name and title for the man page.
|
30 |
|
|
@setfilename gfortran
|
31 |
|
|
@settitle GNU Fortran 95 compiler.
|
32 |
|
|
@c man begin SYNOPSIS
|
33 |
|
|
gfortran [@option{-c}|@option{-S}|@option{-E}]
|
34 |
|
|
[@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
|
35 |
|
|
[@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
|
36 |
|
|
[@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
|
37 |
|
|
[@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
|
38 |
|
|
[@option{-f}@var{option}@dots{}]
|
39 |
|
|
[@option{-m}@var{machine-option}@dots{}]
|
40 |
|
|
[@option{-o} @var{outfile}] @var{infile}@dots{}
|
41 |
|
|
|
42 |
|
|
Only the most useful options are listed here; see below for the
|
43 |
|
|
remainder.
|
44 |
|
|
@c man end
|
45 |
|
|
@c man begin SEEALSO
|
46 |
|
|
gpl(7), gfdl(7), fsf-funding(7),
|
47 |
|
|
cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
|
48 |
|
|
and the Info entries for @file{gcc}, @file{cpp}, @file{gfortran}, @file{as},
|
49 |
|
|
@file{ld}, @file{binutils} and @file{gdb}.
|
50 |
|
|
@c man end
|
51 |
|
|
@c man begin BUGS
|
52 |
|
|
For instructions on reporting bugs, see
|
53 |
|
|
@w{@uref{http://gcc.gnu.org/bugs.html}}.
|
54 |
|
|
@c man end
|
55 |
|
|
@c man begin AUTHOR
|
56 |
|
|
See the Info entry for @command{gfortran} for contributors to GCC and
|
57 |
|
|
GFORTRAN@.
|
58 |
|
|
@c man end
|
59 |
|
|
@end ignore
|
60 |
|
|
|
61 |
|
|
@node Invoking GFORTRAN
|
62 |
|
|
@chapter GNU Fortran 95 Command Options
|
63 |
|
|
@cindex GNU Fortran 95 command options
|
64 |
|
|
@cindex command options
|
65 |
|
|
@cindex options, GNU Fortran 95 command
|
66 |
|
|
|
67 |
|
|
@c man begin DESCRIPTION
|
68 |
|
|
|
69 |
|
|
The @command{gfortran} command supports all the options supported by the
|
70 |
|
|
@command{gcc} command. Only options specific to gfortran are documented here.
|
71 |
|
|
|
72 |
|
|
@xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
|
73 |
|
|
Collection (GCC)}, for information
|
74 |
|
|
on the non-Fortran-specific aspects of the @command{gcc} command (and,
|
75 |
|
|
therefore, the @command{gfortran} command).
|
76 |
|
|
|
77 |
|
|
@cindex options, negative forms
|
78 |
|
|
@cindex negative forms of options
|
79 |
|
|
All @command{gcc} and @command{gfortran} options
|
80 |
|
|
are accepted both by @command{gfortran} and by @command{gcc}
|
81 |
|
|
(as well as any other drivers built at the same time,
|
82 |
|
|
such as @command{g++}),
|
83 |
|
|
since adding @command{gfortran} to the @command{gcc} distribution
|
84 |
|
|
enables acceptance of @command{gfortran} options
|
85 |
|
|
by all of the relevant drivers.
|
86 |
|
|
|
87 |
|
|
In some cases, options have positive and negative forms;
|
88 |
|
|
the negative form of @option{-ffoo} would be @option{-fno-foo}.
|
89 |
|
|
This manual documents only one of these two forms, whichever
|
90 |
|
|
one is not the default.
|
91 |
|
|
@c man end
|
92 |
|
|
|
93 |
|
|
@menu
|
94 |
|
|
* Option Summary:: Brief list of all @command{gfortran} options,
|
95 |
|
|
without explanations.
|
96 |
|
|
* Fortran Dialect Options:: Controlling the variant of Fortran language
|
97 |
|
|
compiled.
|
98 |
|
|
* Warning Options:: How picky should the compiler be?
|
99 |
|
|
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
|
100 |
|
|
* Directory Options:: Where to find module files
|
101 |
|
|
* Runtime Options:: Influencing runtime behavior
|
102 |
|
|
* Code Gen Options:: Specifying conventions for function calls, data layout
|
103 |
|
|
and register usage.
|
104 |
|
|
* Environment Variables:: Env vars that affect GNU Fortran.
|
105 |
|
|
@end menu
|
106 |
|
|
|
107 |
|
|
@node Option Summary
|
108 |
|
|
@section Option Summary
|
109 |
|
|
|
110 |
|
|
@c man begin OPTIONS
|
111 |
|
|
|
112 |
|
|
Here is a summary of all the options specific to GNU Fortran, grouped
|
113 |
|
|
by type. Explanations are in the following sections.
|
114 |
|
|
|
115 |
|
|
@table @emph
|
116 |
|
|
@item Fortran Language Options
|
117 |
|
|
@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
|
118 |
|
|
@gccoptlist{
|
119 |
|
|
-ffree-form -fno-fixed-form @gol
|
120 |
|
|
-fdollar-ok -fimplicit-none -fmax-identifier-length @gol
|
121 |
|
|
-std=@var{std} -fd-lines-as-code -fd-lines-as-comments @gol
|
122 |
|
|
-ffixed-line-length-@var{n} -ffixed-line-length-none @gol
|
123 |
|
|
-ffree-line-length-@var{n} -ffree-line-length-none @gol
|
124 |
|
|
-fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol
|
125 |
|
|
-fcray-pointer }
|
126 |
|
|
|
127 |
|
|
@item Warning Options
|
128 |
|
|
@xref{Warning Options,,Options to Request or Suppress Warnings}.
|
129 |
|
|
@gccoptlist{
|
130 |
|
|
-fsyntax-only -pedantic -pedantic-errors @gol
|
131 |
|
|
-w -Wall -Waliasing -Wampersand -Wconversion -Wimplicit-interface @gol
|
132 |
|
|
-Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
|
133 |
|
|
-Wunused-labels -Wline-truncation -W}
|
134 |
|
|
|
135 |
|
|
@item Debugging Options
|
136 |
|
|
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
|
137 |
|
|
@gccoptlist{
|
138 |
|
|
-fdump-parse-tree -ffpe-trap=@var{list}}
|
139 |
|
|
|
140 |
|
|
@item Directory Options
|
141 |
|
|
@xref{Directory Options,,Options for Directory Search}.
|
142 |
|
|
@gccoptlist{
|
143 |
|
|
-I@var{dir} -M@var{dir}}
|
144 |
|
|
|
145 |
|
|
@item Runtime Options
|
146 |
|
|
@xref{Runtime Options,,Options for influencing runtime behavior}.
|
147 |
|
|
@gccoptlist{
|
148 |
|
|
-fconvert=@var{conversion} -frecord-marker=@var{length}}
|
149 |
|
|
|
150 |
|
|
@item Code Generation Options
|
151 |
|
|
@xref{Code Gen Options,,Options for Code Generation Conventions}.
|
152 |
|
|
@gccoptlist{
|
153 |
|
|
-fno-automatic -ff2c -fno-underscoring -fsecond-underscore @gol
|
154 |
|
|
-fbounds-check -fmax-stack-var-size=@var{n} @gol
|
155 |
|
|
-fpackderived -frepack-arrays -fshort-enums}
|
156 |
|
|
@end table
|
157 |
|
|
|
158 |
|
|
@menu
|
159 |
|
|
* Fortran Dialect Options:: Controlling the variant of Fortran language
|
160 |
|
|
compiled.
|
161 |
|
|
* Warning Options:: How picky should the compiler be?
|
162 |
|
|
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
|
163 |
|
|
* Directory Options:: Where to find module files
|
164 |
|
|
* Runtime Options:: Influencing runtime behavior
|
165 |
|
|
* Code Gen Options:: Specifying conventions for function calls, data layout
|
166 |
|
|
and register usage.
|
167 |
|
|
@end menu
|
168 |
|
|
|
169 |
|
|
@node Fortran Dialect Options
|
170 |
|
|
@section Options Controlling Fortran Dialect
|
171 |
|
|
@cindex dialect options
|
172 |
|
|
@cindex language, dialect options
|
173 |
|
|
@cindex options, dialect
|
174 |
|
|
|
175 |
|
|
The following options control the dialect of Fortran
|
176 |
|
|
that the compiler accepts:
|
177 |
|
|
|
178 |
|
|
@table @gcctabopt
|
179 |
|
|
@cindex -ffree-form option
|
180 |
|
|
@cindex options, -ffree-form
|
181 |
|
|
@cindex -fno-fixed-form option
|
182 |
|
|
@cindex options, -fno-fixed-form
|
183 |
|
|
@cindex source file format
|
184 |
|
|
@cindex free form
|
185 |
|
|
@cindex fixed form
|
186 |
|
|
@cindex Source Form
|
187 |
|
|
@cindex Fortran 90, features
|
188 |
|
|
@item -ffree-form
|
189 |
|
|
@item -ffixed-form
|
190 |
|
|
Specify the layout used by the source file. The free form layout
|
191 |
|
|
was introduced in Fortran 90. Fixed form was traditionally used in
|
192 |
|
|
older Fortran programs.
|
193 |
|
|
|
194 |
|
|
@cindex option, -fd-lines-as-code
|
195 |
|
|
@cindex -fd-lines-as-code, option
|
196 |
|
|
@cindex option, -fd-lines-as-comments
|
197 |
|
|
@cindex -fd-lines-as-comments, option
|
198 |
|
|
@item -fd-lines-as-code
|
199 |
|
|
@item -fd-lines-as-comment
|
200 |
|
|
Enables special treating for lines with @samp{d} or @samp{D} in fixed
|
201 |
|
|
form sources. If the @option{-fd-lines-as-code} option is given
|
202 |
|
|
they are treated as if the first column contained a blank. If the
|
203 |
|
|
@option{-fd-lines-as-comments} option is given, they are treated as
|
204 |
|
|
comment lines.
|
205 |
|
|
|
206 |
|
|
@cindex option, -fdefault-double-8
|
207 |
|
|
@cindex -fdefault-double-8, option
|
208 |
|
|
@item -fdefault-double-8
|
209 |
|
|
Set the "DOUBLE PRECISION" type to an 8 byte wide.
|
210 |
|
|
|
211 |
|
|
@cindex option, -fdefault-integer-8
|
212 |
|
|
@cindex -fdefault-integer-8, option
|
213 |
|
|
@item -fdefault-integer-8
|
214 |
|
|
Set the default integer and logical types to an 8 byte wide type.
|
215 |
|
|
Do nothing if this is already the default.
|
216 |
|
|
|
217 |
|
|
@cindex option, -fdefault-real-8
|
218 |
|
|
@cindex -fdefault-real-8, option
|
219 |
|
|
@item -fdefault-real-8
|
220 |
|
|
Set the default real type to an 8 byte wide type.
|
221 |
|
|
Do nothing if this is already the default.
|
222 |
|
|
|
223 |
|
|
@cindex -fdollar-ok option
|
224 |
|
|
@cindex options, -fdollar-ok
|
225 |
|
|
@item -fdollar-ok
|
226 |
|
|
@cindex dollar sign
|
227 |
|
|
@cindex symbol names
|
228 |
|
|
@cindex character set
|
229 |
|
|
Allow @samp{$} as a valid character in a symbol name.
|
230 |
|
|
|
231 |
|
|
@cindex -fno-backslash option
|
232 |
|
|
@cindex options, -fno-backslash
|
233 |
|
|
@item -fno-backslash
|
234 |
|
|
@cindex backslash
|
235 |
|
|
@cindex escape characters
|
236 |
|
|
Compile switch to change the interpretation of a backslash from
|
237 |
|
|
``C''-style escape characters to a single backslash character.
|
238 |
|
|
|
239 |
|
|
@cindex -ffixed-line-length-@var{n} option
|
240 |
|
|
@cindex options, -ffixed-line-length-@var{n}
|
241 |
|
|
@item -ffixed-line-length-@var{n}
|
242 |
|
|
@cindex source file format
|
243 |
|
|
@cindex lines, length
|
244 |
|
|
@cindex length of source lines
|
245 |
|
|
@cindex fixed form
|
246 |
|
|
@cindex limits, lengths of source lines
|
247 |
|
|
Set column after which characters are ignored in typical fixed-form
|
248 |
|
|
lines in the source file, and through which spaces are assumed (as
|
249 |
|
|
if padded to that length) after the ends of short fixed-form lines.
|
250 |
|
|
|
251 |
|
|
@cindex card image
|
252 |
|
|
@cindex extended-source option
|
253 |
|
|
Popular values for @var{n} include 72 (the
|
254 |
|
|
standard and the default), 80 (card image), and 132 (corresponds
|
255 |
|
|
to ``extended-source'' options in some popular compilers).
|
256 |
|
|
@var{n} may be @samp{none}, meaning that the entire line is meaningful
|
257 |
|
|
and that continued character constants never have implicit spaces appended
|
258 |
|
|
to them to fill out the line.
|
259 |
|
|
@option{-ffixed-line-length-0} means the same thing as
|
260 |
|
|
@option{-ffixed-line-length-none}.
|
261 |
|
|
|
262 |
|
|
@cindex -ffree-line-length-@var{n} option
|
263 |
|
|
@cindex options, -ffree-line-length-@var{n}
|
264 |
|
|
@item -ffree-line-length-@var{n}
|
265 |
|
|
@cindex source file format
|
266 |
|
|
@cindex lines, length
|
267 |
|
|
@cindex length of source lines
|
268 |
|
|
@cindex free form
|
269 |
|
|
@cindex limits, lengths of source lines
|
270 |
|
|
Set column after which characters are ignored in typical free-form
|
271 |
|
|
lines in the source file. For free-form, the default value is 132.
|
272 |
|
|
@var{n} may be @samp{none}, meaning that the entire line is meaningful.
|
273 |
|
|
@option{-ffree-line-length-0} means the same thing as
|
274 |
|
|
@option{-ffree-line-length-none}.
|
275 |
|
|
|
276 |
|
|
@cindex -fmax-identifier-length=@var{n} option
|
277 |
|
|
@cindex option -fmax-identifier-length=@var{n}
|
278 |
|
|
@item -fmax-identifier-length=@var{n}
|
279 |
|
|
Specify the maximum allowed identifier length. Typical values are
|
280 |
|
|
31 (Fortran 95) and 63 (Fortran 200x).
|
281 |
|
|
|
282 |
|
|
@cindex -fimplicit-none option
|
283 |
|
|
@cindex options, -fimplicit-none
|
284 |
|
|
@item -fimplicit-none
|
285 |
|
|
Specify that no implicit typing is allowed, unless overridden by explicit
|
286 |
|
|
@samp{IMPLICIT} statements. This is the equivalent of adding
|
287 |
|
|
@samp{implicit none} to the start of every procedure.
|
288 |
|
|
|
289 |
|
|
@cindex -fcray-pointer option
|
290 |
|
|
@cindex options, -fcray-pointer
|
291 |
|
|
@item -fcray-pointer
|
292 |
|
|
Enables the Cray pointer extension, which provides a C-like pointer.
|
293 |
|
|
|
294 |
|
|
@cindex -std=@var{std} option
|
295 |
|
|
@cindex option, -std=@var{std}
|
296 |
|
|
@item -std=@var{std}
|
297 |
|
|
Conform to the specified standard. Allowed values for @var{std} are
|
298 |
|
|
@samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
|
299 |
|
|
|
300 |
|
|
@end table
|
301 |
|
|
|
302 |
|
|
@node Warning Options
|
303 |
|
|
@section Options to Request or Suppress Warnings
|
304 |
|
|
@cindex options, warnings
|
305 |
|
|
@cindex warnings, suppressing
|
306 |
|
|
@cindex messages, warning
|
307 |
|
|
@cindex suppressing warnings
|
308 |
|
|
|
309 |
|
|
Warnings are diagnostic messages that report constructions which
|
310 |
|
|
are not inherently erroneous but which are risky or suggest there
|
311 |
|
|
might have been an error.
|
312 |
|
|
|
313 |
|
|
You can request many specific warnings with options beginning @option{-W},
|
314 |
|
|
for example @option{-Wimplicit} to request warnings on implicit
|
315 |
|
|
declarations. Each of these specific warning options also has a
|
316 |
|
|
negative form beginning @option{-Wno-} to turn off warnings;
|
317 |
|
|
for example, @option{-Wno-implicit}. This manual lists only one of the
|
318 |
|
|
two forms, whichever is not the default.
|
319 |
|
|
|
320 |
|
|
These options control the amount and kinds of warnings produced by GNU
|
321 |
|
|
Fortran:
|
322 |
|
|
|
323 |
|
|
@table @gcctabopt
|
324 |
|
|
@cindex syntax checking
|
325 |
|
|
@cindex -fsyntax-only option
|
326 |
|
|
@cindex options, -fsyntax-only
|
327 |
|
|
@item -fsyntax-only
|
328 |
|
|
Check the code for syntax errors, but don't do anything beyond that.
|
329 |
|
|
|
330 |
|
|
@cindex -pedantic option
|
331 |
|
|
@cindex options, -pedantic
|
332 |
|
|
@item -pedantic
|
333 |
|
|
Issue warnings for uses of extensions to FORTRAN 95.
|
334 |
|
|
@option{-pedantic} also applies to C-language constructs where they
|
335 |
|
|
occur in GNU Fortran source files, such as use of @samp{\e} in a
|
336 |
|
|
character constant within a directive like @samp{#include}.
|
337 |
|
|
|
338 |
|
|
Valid FORTRAN 95 programs should compile properly with or without
|
339 |
|
|
this option.
|
340 |
|
|
However, without this option, certain GNU extensions and traditional
|
341 |
|
|
Fortran features are supported as well.
|
342 |
|
|
With this option, many of them are rejected.
|
343 |
|
|
|
344 |
|
|
Some users try to use @option{-pedantic} to check programs for conformance.
|
345 |
|
|
They soon find that it does not do quite what they want---it finds some
|
346 |
|
|
nonstandard practices, but not all.
|
347 |
|
|
However, improvements to @command{gfortran} in this area are welcome.
|
348 |
|
|
|
349 |
|
|
This should be used in conjunction with -std=@var{std}.
|
350 |
|
|
|
351 |
|
|
@cindex -pedantic-errors option
|
352 |
|
|
@cindex options, -pedantic-errors
|
353 |
|
|
@item -pedantic-errors
|
354 |
|
|
Like @option{-pedantic}, except that errors are produced rather than
|
355 |
|
|
warnings.
|
356 |
|
|
|
357 |
|
|
@cindex -w option
|
358 |
|
|
@cindex options, -w
|
359 |
|
|
@item -w
|
360 |
|
|
Inhibit all warning messages.
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
@cindex -Wall option
|
364 |
|
|
@cindex options, -Wall
|
365 |
|
|
@item -Wall
|
366 |
|
|
@cindex all warnings
|
367 |
|
|
@cindex warnings, all
|
368 |
|
|
Enables commonly used warning options pertaining to usage that
|
369 |
|
|
we recommend avoiding and that we believe are easy to avoid. This currently
|
370 |
|
|
includes @option{-Wunused-labels}, @option{-Waliasing}, @option{-Wampersand},
|
371 |
|
|
@option{-Wsurprising}, @option{-Wnonstd-intrinsic},
|
372 |
|
|
and @option{-Wline-truncation}.
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
@cindex -Waliasing option
|
376 |
|
|
@cindex options, -Waliasing
|
377 |
|
|
@item -Waliasing
|
378 |
|
|
@cindex aliasing
|
379 |
|
|
Warn about possible aliasing of dummy arguments. Specifically, it warns
|
380 |
|
|
if the same actual argument is associated with a dummy argument with
|
381 |
|
|
@code{intent(in)} and a dummy argument with @code{intent(out)} in a call
|
382 |
|
|
with an explicit interface.
|
383 |
|
|
|
384 |
|
|
The following example will trigger the warning.
|
385 |
|
|
@smallexample
|
386 |
|
|
interface
|
387 |
|
|
subroutine bar(a,b)
|
388 |
|
|
integer, intent(in) :: a
|
389 |
|
|
integer, intent(out) :: b
|
390 |
|
|
end subroutine
|
391 |
|
|
end interface
|
392 |
|
|
integer :: a
|
393 |
|
|
|
394 |
|
|
call bar(a,a)
|
395 |
|
|
@end smallexample
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
@cindex -Wampersand option
|
399 |
|
|
@cindex options, -Wampersand
|
400 |
|
|
@item -Wampersand
|
401 |
|
|
@cindex ampersand
|
402 |
|
|
Warn about missing ampersand in continued character literals. The warning is
|
403 |
|
|
given with @option{-Wampersand}, @option{-pedantic}, and @option{-std=f95}.
|
404 |
|
|
Note: With no ampersand given in a continued character literal, gfortran
|
405 |
|
|
assumes continuation at the first non-comment, non-whitespace character.
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
@cindex -Wconversion option
|
409 |
|
|
@cindex options, -Wconversion
|
410 |
|
|
@item -Wconversion
|
411 |
|
|
@cindex conversion
|
412 |
|
|
Warn about implicit conversions between different types.
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
@cindex -Wimplicit-interface option
|
416 |
|
|
@cindex options, -Wimplicit-interface
|
417 |
|
|
@item -Wimplicit-interface
|
418 |
|
|
Warn about when procedure are called without an explicit interface.
|
419 |
|
|
Note this only checks that an explicit interface is present. It does not
|
420 |
|
|
check that the declared interfaces are consistent across program units.
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
@cindex -Wnonstd-intrinsic option
|
424 |
|
|
@cindex options, -Wnonstd-intrinsic
|
425 |
|
|
@item -Wnonstd-intrinsic
|
426 |
|
|
Warn if the user tries to use an intrinsic that does not belong to the
|
427 |
|
|
standard the user has chosen via the -std option.
|
428 |
|
|
|
429 |
|
|
|
430 |
|
|
@cindex -Wsurprising
|
431 |
|
|
@cindex options, -Wsurprising
|
432 |
|
|
@item -Wsurprising
|
433 |
|
|
@cindex Suspicious
|
434 |
|
|
Produce a warning when ``suspicious'' code constructs are encountered.
|
435 |
|
|
While technically legal these usually indicate that an error has been made.
|
436 |
|
|
|
437 |
|
|
This currently produces a warning under the following circumstances:
|
438 |
|
|
|
439 |
|
|
@itemize @bullet
|
440 |
|
|
@item
|
441 |
|
|
An INTEGER SELECT construct has a CASE that can never be matched as its
|
442 |
|
|
lower value is greater than its upper value.
|
443 |
|
|
|
444 |
|
|
@item
|
445 |
|
|
A LOGICAL SELECT construct has three CASE statements.
|
446 |
|
|
@end itemize
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
@cindex -Wunderflow
|
450 |
|
|
@cindex options, -Wunderflow
|
451 |
|
|
@item -Wunderflow
|
452 |
|
|
@cindex UNDERFLOW
|
453 |
|
|
Produce a warning when numerical constant expressions are
|
454 |
|
|
encountered, which yield an UNDERFLOW during compilation.
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
@cindex -Wunused-labels option
|
458 |
|
|
@cindex options, -Wunused-labels
|
459 |
|
|
@item -Wunused-labels
|
460 |
|
|
@cindex unused labels
|
461 |
|
|
@cindex labels, unused
|
462 |
|
|
Warn whenever a label is defined but never referenced.
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
@cindex -Werror
|
466 |
|
|
@cindex options, -Werror
|
467 |
|
|
@item -Werror
|
468 |
|
|
Turns all warnings into errors.
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
@cindex -W option
|
472 |
|
|
@cindex options, -W
|
473 |
|
|
@item -W
|
474 |
|
|
@cindex extra warnings
|
475 |
|
|
@cindex warnings, extra
|
476 |
|
|
Turns on ``extra warnings'' and, if optimization is specified
|
477 |
|
|
via @option{-O}, the @option{-Wuninitialized} option.
|
478 |
|
|
(This might change in future versions of @command{gfortran}
|
479 |
|
|
@end table
|
480 |
|
|
|
481 |
|
|
@xref{Warning Options,,Options to Request or Suppress Warnings,
|
482 |
|
|
gcc,Using the GNU Compiler Collection (GCC)}, for information on more
|
483 |
|
|
options offered by the GBE shared by @command{gfortran}, @command{gcc} and
|
484 |
|
|
other GNU compilers.
|
485 |
|
|
|
486 |
|
|
Some of these have no effect when compiling programs written in Fortran.
|
487 |
|
|
|
488 |
|
|
@node Debugging Options
|
489 |
|
|
@section Options for Debugging Your Program or GNU Fortran
|
490 |
|
|
@cindex options, debugging
|
491 |
|
|
@cindex debugging information options
|
492 |
|
|
|
493 |
|
|
GNU Fortran has various special options that are used for debugging
|
494 |
|
|
either your program or @command{gfortran}
|
495 |
|
|
|
496 |
|
|
@table @gcctabopt
|
497 |
|
|
@cindex -fdump-parse-tree option
|
498 |
|
|
@cindex option, -fdump-parse-tree
|
499 |
|
|
@item -fdump-parse-tree
|
500 |
|
|
Output the internal parse tree before starting code generation. Only
|
501 |
|
|
really useful for debugging gfortran itself.
|
502 |
|
|
@end table
|
503 |
|
|
|
504 |
|
|
@table @gcctabopt
|
505 |
|
|
@cindex -ffpe-trap=@var{list} option
|
506 |
|
|
@cindex option, -ffpe-trap=@var{list}
|
507 |
|
|
@item -ffpe-trap=@var{list}
|
508 |
|
|
Specify a list of IEEE exceptions when a Floating Point Exception
|
509 |
|
|
(FPE) should be raised. On most systems, this will result in a SIGFPE
|
510 |
|
|
signal being sent and the program being interrupted, producing a core
|
511 |
|
|
file useful for debugging. @var{list} is a (possibly empty) comma-separated
|
512 |
|
|
list of the following IEEE exceptions: @samp{invalid} (invalid floating
|
513 |
|
|
point operation, such as @code{sqrt(-1.0)}), @samp{zero} (division by
|
514 |
|
|
zero), @samp{overflow} (overflow in a floating point operation),
|
515 |
|
|
@samp{underflow} (underflow in a floating point operation),
|
516 |
|
|
@samp{precision} (loss of precision during operation) and @samp{denormal}
|
517 |
|
|
(operation produced a denormal denormal value).
|
518 |
|
|
@end table
|
519 |
|
|
|
520 |
|
|
@xref{Debugging Options,,Options for Debugging Your Program or GCC,
|
521 |
|
|
gcc,Using the GNU Compiler Collection (GCC)}, for more information on
|
522 |
|
|
debugging options.
|
523 |
|
|
|
524 |
|
|
@node Directory Options
|
525 |
|
|
@section Options for Directory Search
|
526 |
|
|
@cindex directory, options
|
527 |
|
|
@cindex options, directory search
|
528 |
|
|
@cindex search path
|
529 |
|
|
|
530 |
|
|
@cindex INCLUDE directive
|
531 |
|
|
@cindex directive, INCLUDE
|
532 |
|
|
These options affect how @command{gfortran} searches
|
533 |
|
|
for files specified by the @code{INCLUDE} directive and where it searches
|
534 |
|
|
for previously compiled modules.
|
535 |
|
|
|
536 |
|
|
It also affects the search paths used by @command{cpp} when used to preprocess
|
537 |
|
|
Fortran source.
|
538 |
|
|
|
539 |
|
|
@table @gcctabopt
|
540 |
|
|
@cindex -Idir option
|
541 |
|
|
@cindex options, -Idir
|
542 |
|
|
@item -I@var{dir}
|
543 |
|
|
@cindex directory, search paths for inclusion
|
544 |
|
|
@cindex inclusion, directory search paths for
|
545 |
|
|
@cindex search paths, for included files
|
546 |
|
|
@cindex paths, search
|
547 |
|
|
@cindex module search path
|
548 |
|
|
These affect interpretation of the @code{INCLUDE} directive
|
549 |
|
|
(as well as of the @code{#include} directive of the @command{cpp}
|
550 |
|
|
preprocessor).
|
551 |
|
|
|
552 |
|
|
Also note that the general behavior of @option{-I} and
|
553 |
|
|
@code{INCLUDE} is pretty much the same as of @option{-I} with
|
554 |
|
|
@code{#include} in the @command{cpp} preprocessor, with regard to
|
555 |
|
|
looking for @file{header.gcc} files and other such things.
|
556 |
|
|
|
557 |
|
|
This path is also used to search for @samp{.mod} files when previously
|
558 |
|
|
compiled modules are required by a @code{USE} statement.
|
559 |
|
|
|
560 |
|
|
@xref{Directory Options,,Options for Directory Search,
|
561 |
|
|
gcc,Using the GNU Compiler Collection (GCC)}, for information on the
|
562 |
|
|
@option{-I} option.
|
563 |
|
|
|
564 |
|
|
@cindex -Mdir option
|
565 |
|
|
@cindex option, -Mdir
|
566 |
|
|
@item -M@var{dir}
|
567 |
|
|
@item -J@var{dir}
|
568 |
|
|
This option specifies where to put @samp{.mod} files for compiled modules.
|
569 |
|
|
It is also added to the list of directories to searched by an @code{USE}
|
570 |
|
|
statement.
|
571 |
|
|
|
572 |
|
|
The default is the current directory.
|
573 |
|
|
|
574 |
|
|
@option{-J} is an alias for @option{-M} to avoid conflicts with existing
|
575 |
|
|
GCC options.
|
576 |
|
|
@end table
|
577 |
|
|
|
578 |
|
|
@node Runtime Options
|
579 |
|
|
@section Influencing runtime behavior
|
580 |
|
|
@cindex runtime, options
|
581 |
|
|
|
582 |
|
|
These options affect the runtime behavior of @command{gfortran}.
|
583 |
|
|
@table @gcctabopt
|
584 |
|
|
@cindex -fconvert=@var{conversion} option
|
585 |
|
|
@item -fconvert=@var{conversion}
|
586 |
|
|
Specify the representation of data for unformatted files. Valid
|
587 |
|
|
values for conversion are: @samp{native}, the default; @samp{swap},
|
588 |
|
|
swap between big- and little-endian; @samp{big-endian}, use big-endian
|
589 |
|
|
representation for unformatted files; @samp{little-endian}, use little-endian
|
590 |
|
|
representation for unformatted files.
|
591 |
|
|
|
592 |
|
|
@emph{This option has an effect only when used in the main program.
|
593 |
|
|
The @code{CONVERT} specifier and the GFORTRAN_CONVERT_UNIT environment
|
594 |
|
|
variable override the default specified by -fconvert.}
|
595 |
|
|
|
596 |
|
|
@cindex -frecord-marker=@var{length}
|
597 |
|
|
@item -frecord-marker=@var{length}
|
598 |
|
|
Specify the length of record markers for unformatted files.
|
599 |
|
|
Valid values for @var{length} are 4 and 8. Default is whatever
|
600 |
|
|
@code{off_t} is specified to be on that particular system.
|
601 |
|
|
Note that specifying @var{length} as 4 limits the record
|
602 |
|
|
length of unformatted files to 2 GB. This option does not
|
603 |
|
|
extend the maximum possible record length on systems where
|
604 |
|
|
@code{off_t} is a four_byte quantity.
|
605 |
|
|
|
606 |
|
|
@end table
|
607 |
|
|
|
608 |
|
|
@node Code Gen Options
|
609 |
|
|
@section Options for Code Generation Conventions
|
610 |
|
|
@cindex code generation, conventions
|
611 |
|
|
@cindex options, code generation
|
612 |
|
|
@cindex run-time, options
|
613 |
|
|
|
614 |
|
|
These machine-independent options control the interface conventions
|
615 |
|
|
used in code generation.
|
616 |
|
|
|
617 |
|
|
Most of them have both positive and negative forms; the negative form
|
618 |
|
|
of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
|
619 |
|
|
one of the forms is listed---the one which is not the default. You
|
620 |
|
|
can figure out the other form by either removing @option{no-} or adding
|
621 |
|
|
it.
|
622 |
|
|
|
623 |
|
|
@table @gcctabopt
|
624 |
|
|
@cindex @option{-fno-automatic} option
|
625 |
|
|
@cindex options, @option{-fno-automatic}
|
626 |
|
|
@item -fno-automatic
|
627 |
|
|
@cindex SAVE statement
|
628 |
|
|
@cindex statements, SAVE
|
629 |
|
|
Treat each program unit as if the @code{SAVE} statement was specified for
|
630 |
|
|
every local variable and array referenced in it. Does not affect common
|
631 |
|
|
blocks. (Some Fortran compilers provide this option under the name
|
632 |
|
|
@option{-static}.)
|
633 |
|
|
|
634 |
|
|
@cindex @option{-ff2c} option
|
635 |
|
|
@cindex options, @option{-ff2c}
|
636 |
|
|
@item -ff2c
|
637 |
|
|
@cindex calling convention
|
638 |
|
|
@cindex @command{f2c} calling convention
|
639 |
|
|
@cindex @command{g77} calling convention
|
640 |
|
|
@cindex libf2c calling convention
|
641 |
|
|
Generate code designed to be compatible with code generated
|
642 |
|
|
by @command{g77} and @command{f2c}.
|
643 |
|
|
|
644 |
|
|
The calling conventions used by @command{g77} (originally implemented
|
645 |
|
|
in @command{f2c}) require functions that return type
|
646 |
|
|
default @code{REAL} to actually return the C type @code{double}, and
|
647 |
|
|
functions that return type @code{COMPLEX} to return the values via an
|
648 |
|
|
extra argument in the calling sequence that points to where to
|
649 |
|
|
store the return value. Under the default GNU calling conventions, such
|
650 |
|
|
functions simply return their results as they would in GNU
|
651 |
|
|
C -- default @code{REAL} functions return the C type @code{float}, and
|
652 |
|
|
@code{COMPLEX} functions return the GNU C type @code{complex}.
|
653 |
|
|
Additionally, this option implies the @option{-fsecond-underscore}
|
654 |
|
|
option, unless @option{-fno-second-underscore} is explicitly requested.
|
655 |
|
|
|
656 |
|
|
This does not affect the generation of code that interfaces with
|
657 |
|
|
the @command{libgfortran} library.
|
658 |
|
|
|
659 |
|
|
@emph{Caution:} It is not a good idea to mix Fortran code compiled
|
660 |
|
|
with @code{-ff2c} with code compiled with the default @code{-fno-f2c}
|
661 |
|
|
calling conventions as, calling @code{COMPLEX} or default @code{REAL}
|
662 |
|
|
functions between program parts which were compiled with different
|
663 |
|
|
calling conventions will break at execution time.
|
664 |
|
|
|
665 |
|
|
@emph{Caution:} This will break code which passes intrinsic functions
|
666 |
|
|
of type default @code{REAL} or @code{COMPLEX} as actual arguments, as
|
667 |
|
|
the library implementations use the @command{-fno-f2c} calling conventions.
|
668 |
|
|
|
669 |
|
|
@cindex @option{-fno-underscoring option}
|
670 |
|
|
@cindex options, @option{-fno-underscoring}
|
671 |
|
|
@item -fno-underscoring
|
672 |
|
|
@cindex underscore
|
673 |
|
|
@cindex symbol names, underscores
|
674 |
|
|
@cindex transforming symbol names
|
675 |
|
|
@cindex symbol names, transforming
|
676 |
|
|
Do not transform names of entities specified in the Fortran
|
677 |
|
|
source file by appending underscores to them.
|
678 |
|
|
|
679 |
|
|
With @option{-funderscoring} in effect, @command{gfortran} appends one
|
680 |
|
|
underscore to external names with no underscores. This is done to ensure
|
681 |
|
|
compatibility with code produced by many UNIX Fortran compilers.
|
682 |
|
|
|
683 |
|
|
@emph{Caution}: The default behavior of @command{gfortran} is
|
684 |
|
|
incompatible with @command{f2c} and @command{g77}, please use the
|
685 |
|
|
@option{-ff2c} option if you want object files compiled with
|
686 |
|
|
@option{gfortran} to be compatible with object code created with these
|
687 |
|
|
tools.
|
688 |
|
|
|
689 |
|
|
Use of @option{-fno-underscoring} is not recommended unless you are
|
690 |
|
|
experimenting with issues such as integration of (GNU) Fortran into
|
691 |
|
|
existing system environments (vis-a-vis existing libraries, tools, and
|
692 |
|
|
so on).
|
693 |
|
|
|
694 |
|
|
For example, with @option{-funderscoring}, and assuming other defaults like
|
695 |
|
|
@option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
|
696 |
|
|
external functions while @samp{my_var} and @samp{lvar} are local variables,
|
697 |
|
|
a statement like
|
698 |
|
|
|
699 |
|
|
@smallexample
|
700 |
|
|
I = J() + MAX_COUNT (MY_VAR, LVAR)
|
701 |
|
|
@end smallexample
|
702 |
|
|
|
703 |
|
|
@noindent
|
704 |
|
|
is implemented as something akin to:
|
705 |
|
|
|
706 |
|
|
@smallexample
|
707 |
|
|
i = j_() + max_count__(&my_var__, &lvar);
|
708 |
|
|
@end smallexample
|
709 |
|
|
|
710 |
|
|
With @option{-fno-underscoring}, the same statement is implemented as:
|
711 |
|
|
|
712 |
|
|
@smallexample
|
713 |
|
|
i = j() + max_count(&my_var, &lvar);
|
714 |
|
|
@end smallexample
|
715 |
|
|
|
716 |
|
|
Use of @option{-fno-underscoring} allows direct specification of
|
717 |
|
|
user-defined names while debugging and when interfacing @command{gfortran}
|
718 |
|
|
code with other languages.
|
719 |
|
|
|
720 |
|
|
Note that just because the names match does @emph{not} mean that the
|
721 |
|
|
interface implemented by @command{gfortran} for an external name matches the
|
722 |
|
|
interface implemented by some other language for that same name.
|
723 |
|
|
That is, getting code produced by @command{gfortran} to link to code produced
|
724 |
|
|
by some other compiler using this or any other method can be only a
|
725 |
|
|
small part of the overall solution---getting the code generated by
|
726 |
|
|
both compilers to agree on issues other than naming can require
|
727 |
|
|
significant effort, and, unlike naming disagreements, linkers normally
|
728 |
|
|
cannot detect disagreements in these other areas.
|
729 |
|
|
|
730 |
|
|
Also, note that with @option{-fno-underscoring}, the lack of appended
|
731 |
|
|
underscores introduces the very real possibility that a user-defined
|
732 |
|
|
external name will conflict with a name in a system library, which
|
733 |
|
|
could make finding unresolved-reference bugs quite difficult in some
|
734 |
|
|
cases---they might occur at program run time, and show up only as
|
735 |
|
|
buggy behavior at run time.
|
736 |
|
|
|
737 |
|
|
In future versions of @command{gfortran} we hope to improve naming and linking
|
738 |
|
|
issues so that debugging always involves using the names as they appear
|
739 |
|
|
in the source, even if the names as seen by the linker are mangled to
|
740 |
|
|
prevent accidental linking between procedures with incompatible
|
741 |
|
|
interfaces.
|
742 |
|
|
|
743 |
|
|
@cindex @option{-fsecond-underscore option}
|
744 |
|
|
@cindex options, @option{-fsecond-underscore}
|
745 |
|
|
@item -fsecond-underscore
|
746 |
|
|
@cindex underscore
|
747 |
|
|
@cindex symbol names, underscores
|
748 |
|
|
@cindex transforming symbol names
|
749 |
|
|
@cindex symbol names, transforming
|
750 |
|
|
@cindex @command{f2c} calling convention
|
751 |
|
|
@cindex @command{g77} calling convention
|
752 |
|
|
@cindex libf2c calling convention
|
753 |
|
|
By default, @command{gfortran} appends an underscore to external
|
754 |
|
|
names. If this option is used @command{gfortran} appends two
|
755 |
|
|
underscores to names with underscores and one underscore to external names
|
756 |
|
|
with no underscores. (@command{gfortran} also appends two underscores to
|
757 |
|
|
internal names with underscores to avoid naming collisions with external
|
758 |
|
|
names.
|
759 |
|
|
|
760 |
|
|
This option has no effect if @option{-fno-underscoring} is
|
761 |
|
|
in effect. It is implied by the @option{-ff2c} option.
|
762 |
|
|
|
763 |
|
|
Otherwise, with this option, an external name such as @samp{MAX_COUNT}
|
764 |
|
|
is implemented as a reference to the link-time external symbol
|
765 |
|
|
@samp{max_count__}, instead of @samp{max_count_}. This is required
|
766 |
|
|
for compatibility with @command{g77} and @command{f2c}, and is implied
|
767 |
|
|
by use of the @option{-ff2c} option.
|
768 |
|
|
|
769 |
|
|
|
770 |
|
|
@cindex -fbounds-check option
|
771 |
|
|
@cindex -ffortran-bounds-check option
|
772 |
|
|
@item -fbounds-check
|
773 |
|
|
@cindex bounds checking
|
774 |
|
|
@cindex range checking
|
775 |
|
|
@cindex array bounds checking
|
776 |
|
|
@cindex subscript checking
|
777 |
|
|
@cindex checking subscripts
|
778 |
|
|
Enable generation of run-time checks for array subscripts
|
779 |
|
|
and against the declared minimum and maximum values. It also
|
780 |
|
|
checks array indices for assumed and deferred
|
781 |
|
|
shape arrays against the actual allocated bounds.
|
782 |
|
|
|
783 |
|
|
In the future this may also include other forms of checking, eg. checking
|
784 |
|
|
substring references.
|
785 |
|
|
|
786 |
|
|
|
787 |
|
|
@cindex -fmax-stack-var-size option
|
788 |
|
|
@item -fmax-stack-var-size=@var{n}
|
789 |
|
|
This option specifies the size in bytes of the largest array that will be put
|
790 |
|
|
on the stack.
|
791 |
|
|
|
792 |
|
|
This option currently only affects local arrays declared with constant
|
793 |
|
|
bounds, and may not apply to all character variables.
|
794 |
|
|
Future versions of @command{gfortran} may improve this behavior.
|
795 |
|
|
|
796 |
|
|
The default value for @var{n} is 32768.
|
797 |
|
|
|
798 |
|
|
@cindex -fpackderived
|
799 |
|
|
@item -fpackderived
|
800 |
|
|
@cindex Structure packing
|
801 |
|
|
This option tells gfortran to pack derived type members as closely as
|
802 |
|
|
possible. Code compiled with this option is likely to be incompatible
|
803 |
|
|
with code compiled without this option, and may execute slower.
|
804 |
|
|
|
805 |
|
|
@cindex -frepack-arrays option
|
806 |
|
|
@item -frepack-arrays
|
807 |
|
|
@cindex Repacking arrays
|
808 |
|
|
In some circumstances @command{gfortran} may pass assumed shape array
|
809 |
|
|
sections via a descriptor describing a discontiguous area of memory.
|
810 |
|
|
This option adds code to the function prologue to repack the data into
|
811 |
|
|
a contiguous block at runtime.
|
812 |
|
|
|
813 |
|
|
This should result in faster accesses to the array. However it can introduce
|
814 |
|
|
significant overhead to the function call, especially when the passed data
|
815 |
|
|
is discontiguous.
|
816 |
|
|
|
817 |
|
|
@cindex -fshort-enums
|
818 |
|
|
@item -fshort-enums
|
819 |
|
|
This option is provided for interoperability with C code that was
|
820 |
|
|
compiled with the @command{-fshort-enums} option. It will make
|
821 |
|
|
@command{gfortran} choose the smallest @code{INTEGER} kind a given
|
822 |
|
|
enumerator set will fit in, and give all its enumerators this kind.
|
823 |
|
|
@end table
|
824 |
|
|
|
825 |
|
|
@xref{Code Gen Options,,Options for Code Generation Conventions,
|
826 |
|
|
gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
|
827 |
|
|
offered by the GBE
|
828 |
|
|
shared by @command{gfortran} @command{gcc} and other GNU compilers.
|
829 |
|
|
|
830 |
|
|
|
831 |
|
|
@c man end
|
832 |
|
|
|
833 |
|
|
@node Environment Variables
|
834 |
|
|
@section Environment Variables Affecting GNU Fortran
|
835 |
|
|
@cindex environment variables
|
836 |
|
|
|
837 |
|
|
@c man begin ENVIRONMENT
|
838 |
|
|
|
839 |
|
|
GNU Fortran 95 currently does not make use of any environment
|
840 |
|
|
variables to control its operation above and beyond those
|
841 |
|
|
that affect the operation of @command{gcc}.
|
842 |
|
|
|
843 |
|
|
@xref{Environment Variables,,Environment Variables Affecting GCC,
|
844 |
|
|
gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
|
845 |
|
|
variables.
|
846 |
|
|
|
847 |
|
|
@xref{Runtime}, for environment variables that affect the
|
848 |
|
|
run-time behavior of @command{gfortran} programs.
|
849 |
|
|
@c man end
|