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