1GFORTRAN(1) GNU GFORTRAN(1)
2
3
4
6 gfortran - GNU Fortran compiler
7
9 gfortran [-c|-S|-E]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-pedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...]
15 [-mmachine-option...]
16 [-o outfile] infile...
17
18 Only the most useful options are listed here; see below for the
19 remainder.
20
22 The gfortran command supports all the options supported by the gcc
23 command. Only options specific to GNU Fortran are documented here.
24
25 All GCC and GNU Fortran options are accepted both by gfortran and by
26 gcc (as well as any other drivers built at the same time, such as g++),
27 since adding GNU Fortran to the GCC distribution enables acceptance of
28 GNU Fortran options by all of the relevant drivers.
29
30 In some cases, options have positive and negative forms; the negative
31 form of -ffoo would be -fno-foo. This manual documents only one of
32 these two forms, whichever one is not the default.
33
35 Here is a summary of all the options specific to GNU Fortran, grouped
36 by type. Explanations are in the following sections.
37
38 Fortran Language Options
39 -fall-intrinsics -fallow-argument-mismatch -fallow-invalid-boz
40 -fbackslash -fcray-pointer -fd-lines-as-code -fd-lines-as-comments
41 -fdec -fdec-char-conversions -fdec-structure -fdec-intrinsic-ints
42 -fdec-static -fdec-math -fdec-include -fdec-format-defaults
43 -fdec-blank-format-item -fdefault-double-8 -fdefault-integer-8
44 -fdefault-real-8 -fdefault-real-10 -fdefault-real-16 -fdollar-ok
45 -ffixed-line-length-n -ffixed-line-length-none -fpad-source
46 -ffree-form -ffree-line-length-n -ffree-line-length-none
47 -fimplicit-none -finteger-4-integer-8 -fmax-identifier-length
48 -fmodule-private -ffixed-form -fno-range-check -fopenacc -fopenmp
49 -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 -freal-8-real-10
50 -freal-8-real-16 -freal-8-real-4 -std=std -ftest-forall-temp
51
52 Preprocessing Options
53 -A-question[=answer] -Aquestion=answer -C -CC -Dmacro[=defn] -H -P
54 -Umacro -cpp -dD -dI -dM -dN -dU -fworking-directory -imultilib dir
55 -iprefix file -iquote -isysroot dir -isystem dir -nocpp -nostdinc
56 -undef
57
58 Error and Warning Options
59 -Waliasing -Wall -Wampersand -Warray-bounds -Wc-binding-type
60 -Wcharacter-truncation -Wconversion -Wdo-subscript
61 -Wfunction-elimination -Wimplicit-interface -Wimplicit-procedure
62 -Wintrinsic-shadow -Wuse-without-only -Wintrinsics-std
63 -Wline-truncation -Wno-align-commons -Wno-overwrite-recursive
64 -Wno-tabs -Wreal-q-constant -Wsurprising -Wunderflow
65 -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all
66 -Wfrontend-loop-interchange -Wtarget-lifetime -fmax-errors=n
67 -fsyntax-only -pedantic -pedantic-errors
68
69 Debugging Options
70 -fbacktrace -fdump-fortran-optimized -fdump-fortran-original
71 -fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree
72 -ffpe-trap=list -ffpe-summary=list
73
74 Directory Options
75 -Idir -Jdir -fintrinsic-modules-path dir
76
77 Link Options
78 -static-libgfortran
79
80 Runtime Options
81 -fconvert=conversion -fmax-subrecord-length=length
82 -frecord-marker=length -fsign-zero
83
84 Interoperability Options
85 -fc-prototypes -fc-prototypes-external
86
87 Code Generation Options
88 -faggressive-function-elimination -fblas-matmul-limit=n
89 -fbounds-check -ftail-call-workaround -ftail-call-workaround=n
90 -fcheck-array-temporaries
91 -fcheck=<all|array-temps|bits|bounds|do|mem|pointer|recursion>
92 -fcoarray=<none|single|lib> -fexternal-blas -ff2c
93 -ffrontend-loop-interchange -ffrontend-optimize -finit-character=n
94 -finit-integer=n -finit-local-zero -finit-derived
95 -finit-logical=<true|false> -finit-real=<zero|inf|-inf|nan|snan>
96 -finline-matmul-limit=n -finline-arg-packing
97 -fmax-array-constructor=n -fmax-stack-var-size=n -fno-align-commons
98 -fno-automatic -fno-protect-parens -fno-underscoring
99 -fsecond-underscore -fpack-derived -frealloc-lhs -frecursive
100 -frepack-arrays -fshort-enums -fstack-arrays
101
102 Options controlling Fortran dialect
103 The following options control the details of the Fortran dialect
104 accepted by the compiler:
105
106 -ffree-form
107 -ffixed-form
108 Specify the layout used by the source file. The free form layout
109 was introduced in Fortran 90. Fixed form was traditionally used in
110 older Fortran programs. When neither option is specified, the
111 source form is determined by the file extension.
112
113 -fall-intrinsics
114 This option causes all intrinsic procedures (including the GNU-
115 specific extensions) to be accepted. This can be useful with
116 -std=f95 to force standard-compliance but get access to the full
117 range of intrinsics available with gfortran. As a consequence,
118 -Wintrinsics-std will be ignored and no user-defined procedure with
119 the same name as any intrinsic will be called except when it is
120 explicitly declared "EXTERNAL".
121
122 -fallow-argument-mismatch
123 Some code contains calls to external procedures with mismatches
124 between the calls and the procedure definition, or with mismatches
125 between different calls. Such code is non-conforming, and will
126 usually be flagged with an error. This options degrades the error
127 to a warning, which can only be disabled by disabling all warnings
128 via -w. Only a single occurrence per argument is flagged by this
129 warning. -fallow-argument-mismatch is implied by -std=legacy.
130
131 Using this option is strongly discouraged. It is possible to
132 provide standard-conforming code which allows different types of
133 arguments by using an explicit interface and TYPE(*).
134
135 -fallow-invalid-boz
136 A BOZ literal constant can occur in a limited number of contexts in
137 standard conforming Fortran. This option degrades an error
138 condition to a warning, and allows a BOZ literal constant to appear
139 where the Fortran standard would otherwise prohibit its use.
140
141 -fd-lines-as-code
142 -fd-lines-as-comments
143 Enable special treatment for lines beginning with "d" or "D" in
144 fixed form sources. If the -fd-lines-as-code option is given they
145 are treated as if the first column contained a blank. If the
146 -fd-lines-as-comments option is given, they are treated as comment
147 lines.
148
149 -fdec
150 DEC compatibility mode. Enables extensions and other features that
151 mimic the default behavior of older compilers (such as DEC). These
152 features are non-standard and should be avoided at all costs. For
153 details on GNU Fortran's implementation of these extensions see the
154 full documentation.
155
156 Other flags enabled by this switch are: -fdollar-ok -fcray-pointer
157 -fdec-char-conversions -fdec-structure -fdec-intrinsic-ints
158 -fdec-static -fdec-math -fdec-include -fdec-blank-format-item
159 -fdec-format-defaults
160
161 If -fd-lines-as-code/-fd-lines-as-comments are unset, then -fdec
162 also sets -fd-lines-as-comments.
163
164 -fdec-char-conversions
165 Enable the use of character literals in assignments and "DATA"
166 statements for non-character variables.
167
168 -fdec-structure
169 Enable DEC "STRUCTURE" and "RECORD" as well as "UNION", "MAP", and
170 dot ('.') as a member separator (in addition to '%'). This is
171 provided for compatibility only; Fortran 90 derived types should be
172 used instead where possible.
173
174 -fdec-intrinsic-ints
175 Enable B/I/J/K kind variants of existing integer functions (e.g.
176 BIAND, IIAND, JIAND, etc...). For a complete list of intrinsics see
177 the full documentation.
178
179 -fdec-math
180 Enable legacy math intrinsics such as COTAN and degree-valued
181 trigonometric functions (e.g. TAND, ATAND, etc...) for
182 compatability with older code.
183
184 -fdec-static
185 Enable DEC-style STATIC and AUTOMATIC attributes to explicitly
186 specify the storage of variables and other objects.
187
188 -fdec-include
189 Enable parsing of INCLUDE as a statement in addition to parsing it
190 as INCLUDE line. When parsed as INCLUDE statement, INCLUDE does
191 not have to be on a single line and can use line continuations.
192
193 -fdec-format-defaults
194 Enable format specifiers F, G and I to be used without width
195 specifiers, default widths will be used instead.
196
197 -fdec-blank-format-item
198 Enable a blank format item at the end of a format specification
199 i.e. nothing following the final comma.
200
201 -fdollar-ok
202 Allow $ as a valid non-first character in a symbol name. Symbols
203 that start with $ are rejected since it is unclear which rules to
204 apply to implicit typing as different vendors implement different
205 rules. Using $ in "IMPLICIT" statements is also rejected.
206
207 -fbackslash
208 Change the interpretation of backslashes in string literals from a
209 single backslash character to "C-style" escape characters. The
210 following combinations are expanded "\a", "\b", "\f", "\n", "\r",
211 "\t", "\v", "\\", and "\0" to the ASCII characters alert,
212 backspace, form feed, newline, carriage return, horizontal tab,
213 vertical tab, backslash, and NUL, respectively. Additionally,
214 "\x"nn, "\u"nnnn and "\U"nnnnnnnn (where each n is a hexadecimal
215 digit) are translated into the Unicode characters corresponding to
216 the specified code points. All other combinations of a character
217 preceded by \ are unexpanded.
218
219 -fmodule-private
220 Set the default accessibility of module entities to "PRIVATE".
221 Use-associated entities will not be accessible unless they are
222 explicitly declared as "PUBLIC".
223
224 -ffixed-line-length-n
225 Set column after which characters are ignored in typical fixed-form
226 lines in the source file, and, unless "-fno-pad-source", through
227 which spaces are assumed (as if padded to that length) after the
228 ends of short fixed-form lines.
229
230 Popular values for n include 72 (the standard and the default), 80
231 (card image), and 132 (corresponding to "extended-source" options
232 in some popular compilers). n may also be none, meaning that the
233 entire line is meaningful and that continued character constants
234 never have implicit spaces appended to them to fill out the line.
235 -ffixed-line-length-0 means the same thing as
236 -ffixed-line-length-none.
237
238 -fno-pad-source
239 By default fixed-form lines have spaces assumed (as if padded to
240 that length) after the ends of short fixed-form lines. This is not
241 done either if -ffixed-line-length-0, -ffixed-line-length-none or
242 if -fno-pad-source option is used. With any of those options
243 continued character constants never have implicit spaces appended
244 to them to fill out the line.
245
246 -ffree-line-length-n
247 Set column after which characters are ignored in typical free-form
248 lines in the source file. The default value is 132. n may be none,
249 meaning that the entire line is meaningful. -ffree-line-length-0
250 means the same thing as -ffree-line-length-none.
251
252 -fmax-identifier-length=n
253 Specify the maximum allowed identifier length. Typical values are
254 31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
255
256 -fimplicit-none
257 Specify that no implicit typing is allowed, unless overridden by
258 explicit "IMPLICIT" statements. This is the equivalent of adding
259 "implicit none" to the start of every procedure.
260
261 -fcray-pointer
262 Enable the Cray pointer extension, which provides C-like pointer
263 functionality.
264
265 -fopenacc
266 Enable the OpenACC extensions. This includes OpenACC "!$acc"
267 directives in free form and "c$acc", *$acc and "!$acc" directives
268 in fixed form, "!$" conditional compilation sentinels in free form
269 and "c$", "*$" and "!$" sentinels in fixed form, and when linking
270 arranges for the OpenACC runtime library to be linked in.
271
272 -fopenmp
273 Enable the OpenMP extensions. This includes OpenMP "!$omp"
274 directives in free form and "c$omp", *$omp and "!$omp" directives
275 in fixed form, "!$" conditional compilation sentinels in free form
276 and "c$", "*$" and "!$" sentinels in fixed form, and when linking
277 arranges for the OpenMP runtime library to be linked in. The
278 option -fopenmp implies -frecursive.
279
280 -fno-range-check
281 Disable range checking on results of simplification of constant
282 expressions during compilation. For example, GNU Fortran will give
283 an error at compile time when simplifying "a = 1. / 0". With this
284 option, no error will be given and "a" will be assigned the value
285 "+Infinity". If an expression evaluates to a value outside of the
286 relevant range of ["-HUGE()":"HUGE()"], then the expression will be
287 replaced by "-Inf" or "+Inf" as appropriate. Similarly, "DATA
288 i/Z'FFFFFFFF'/" will result in an integer overflow on most systems,
289 but with -fno-range-check the value will "wrap around" and "i" will
290 be initialized to -1 instead.
291
292 -fdefault-integer-8
293 Set the default integer and logical types to an 8 byte wide type.
294 This option also affects the kind of integer constants like 42.
295 Unlike -finteger-4-integer-8, it does not promote variables with
296 explicit kind declaration.
297
298 -fdefault-real-8
299 Set the default real type to an 8 byte wide type. This option also
300 affects the kind of non-double real constants like 1.0. This
301 option promotes the default width of "DOUBLE PRECISION" and double
302 real constants like "1.d0" to 16 bytes if possible. If
303 "-fdefault-double-8" is given along with "fdefault-real-8", "DOUBLE
304 PRECISION" and double real constants are not promoted. Unlike
305 -freal-4-real-8, "fdefault-real-8" does not promote variables with
306 explicit kind declarations.
307
308 -fdefault-real-10
309 Set the default real type to an 10 byte wide type. This option
310 also affects the kind of non-double real constants like 1.0. This
311 option promotes the default width of "DOUBLE PRECISION" and double
312 real constants like "1.d0" to 16 bytes if possible. If
313 "-fdefault-double-8" is given along with "fdefault-real-10",
314 "DOUBLE PRECISION" and double real constants are not promoted.
315 Unlike -freal-4-real-10, "fdefault-real-10" does not promote
316 variables with explicit kind declarations.
317
318 -fdefault-real-16
319 Set the default real type to an 16 byte wide type. This option
320 also affects the kind of non-double real constants like 1.0. This
321 option promotes the default width of "DOUBLE PRECISION" and double
322 real constants like "1.d0" to 16 bytes if possible. If
323 "-fdefault-double-8" is given along with "fdefault-real-16",
324 "DOUBLE PRECISION" and double real constants are not promoted.
325 Unlike -freal-4-real-16, "fdefault-real-16" does not promote
326 variables with explicit kind declarations.
327
328 -fdefault-double-8
329 Set the "DOUBLE PRECISION" type and double real constants like
330 "1.d0" to an 8 byte wide type. Do nothing if this is already the
331 default. This option prevents -fdefault-real-8, -fdefault-real-10,
332 and -fdefault-real-16, from promoting "DOUBLE PRECISION" and double
333 real constants like "1.d0" to 16 bytes.
334
335 -finteger-4-integer-8
336 Promote all "INTEGER(KIND=4)" entities to an "INTEGER(KIND=8)"
337 entities. If "KIND=8" is unavailable, then an error will be
338 issued. This option should be used with care and may not be
339 suitable for your codes. Areas of possible concern include calls
340 to external procedures, alignment in "EQUIVALENCE" and/or "COMMON",
341 generic interfaces, BOZ literal constant conversion, and I/O.
342 Inspection of the intermediate representation of the translated
343 Fortran code, produced by -fdump-tree-original, is suggested.
344
345 -freal-4-real-8
346 -freal-4-real-10
347 -freal-4-real-16
348 -freal-8-real-4
349 -freal-8-real-10
350 -freal-8-real-16
351 Promote all "REAL(KIND=M)" entities to "REAL(KIND=N)" entities. If
352 "REAL(KIND=N)" is unavailable, then an error will be issued. The
353 "-freal-4-" flags also affect the default real kind and the
354 "-freal-8-" flags also the double-precision real kind. All other
355 real-kind types are unaffected by this option. The promotion is
356 also applied to real literal constants of default and double-
357 precision kind and a specified kind number of 4 or 8, respectively.
358 However, "-fdefault-real-8", "-fdefault-real-10",
359 "-fdefault-real-10", and "-fdefault-double-8" take precedence for
360 the default and double-precision real kinds, both for real literal
361 constants and for declarations without a kind number. Note that
362 for "REAL(KIND=KIND(1.0))" the literal may get promoted and then
363 the result may get promoted again. These options should be used
364 with care and may not be suitable for your codes. Areas of
365 possible concern include calls to external procedures, alignment in
366 "EQUIVALENCE" and/or "COMMON", generic interfaces, BOZ literal
367 constant conversion, and I/O and calls to intrinsic procedures when
368 passing a value to the "kind=" dummy argument. Inspection of the
369 intermediate representation of the translated Fortran code,
370 produced by -fdump-fortran-original or -fdump-tree-original, is
371 suggested.
372
373 -std=std
374 Specify the standard to which the program is expected to conform,
375 which may be one of f95, f2003, f2008, f2018, gnu, or legacy. The
376 default value for std is gnu, which specifies a superset of the
377 latest Fortran standard that includes all of the extensions
378 supported by GNU Fortran, although warnings will be given for
379 obsolete extensions not recommended for use in new code. The
380 legacy value is equivalent but without the warnings for obsolete
381 extensions, and may be useful for old non-standard programs. The
382 f95, f2003, f2008, and f2018 values specify strict conformance to
383 the Fortran 95, Fortran 2003, Fortran 2008 and Fortran 2018
384 standards, respectively; errors are given for all extensions beyond
385 the relevant language standard, and warnings are given for the
386 Fortran 77 features that are permitted but obsolescent in later
387 standards. The deprecated option -std=f2008ts acts as an alias for
388 -std=f2018. It is only present for backwards compatibility with
389 earlier gfortran versions and should not be used any more.
390
391 -ftest-forall-temp
392 Enhance test coverage by forcing most forall assignments to use
393 temporary.
394
395 Enable and customize preprocessing
396 Preprocessor related options. See section Preprocessing and conditional
397 compilation for more detailed information on preprocessing in gfortran.
398
399 -cpp
400 -nocpp
401 Enable preprocessing. The preprocessor is automatically invoked if
402 the file extension is .fpp, .FPP, .F, .FOR, .FTN, .F90, .F95, .F03
403 or .F08. Use this option to manually enable preprocessing of any
404 kind of Fortran file.
405
406 To disable preprocessing of files with any of the above listed
407 extensions, use the negative form: -nocpp.
408
409 The preprocessor is run in traditional mode. Any restrictions of
410 the file-format, especially the limits on line length, apply for
411 preprocessed output as well, so it might be advisable to use the
412 -ffree-line-length-none or -ffixed-line-length-none options.
413
414 -dM Instead of the normal output, generate a list of '#define'
415 directives for all the macros defined during the execution of the
416 preprocessor, including predefined macros. This gives you a way of
417 finding out what is predefined in your version of the preprocessor.
418 Assuming you have no file foo.f90, the command
419
420 touch foo.f90; gfortran -cpp -E -dM foo.f90
421
422 will show all the predefined macros.
423
424 -dD Like -dM except in two respects: it does not include the predefined
425 macros, and it outputs both the "#define" directives and the result
426 of preprocessing. Both kinds of output go to the standard output
427 file.
428
429 -dN Like -dD, but emit only the macro names, not their expansions.
430
431 -dU Like dD except that only macros that are expanded, or whose
432 definedness is tested in preprocessor directives, are output; the
433 output is delayed until the use or test of the macro; and '#undef'
434 directives are also output for macros tested but undefined at the
435 time.
436
437 -dI Output '#include' directives in addition to the result of
438 preprocessing.
439
440 -fworking-directory
441 Enable generation of linemarkers in the preprocessor output that
442 will let the compiler know the current working directory at the
443 time of preprocessing. When this option is enabled, the
444 preprocessor will emit, after the initial linemarker, a second
445 linemarker with the current working directory followed by two
446 slashes. GCC will use this directory, when it is present in the
447 preprocessed input, as the directory emitted as the current working
448 directory in some debugging information formats. This option is
449 implicitly enabled if debugging information is enabled, but this
450 can be inhibited with the negated form -fno-working-directory. If
451 the -P flag is present in the command line, this option has no
452 effect, since no "#line" directives are emitted whatsoever.
453
454 -idirafter dir
455 Search dir for include files, but do it after all directories
456 specified with -I and the standard system directories have been
457 exhausted. dir is treated as a system include directory. If dir
458 begins with "=", then the "=" will be replaced by the sysroot
459 prefix; see --sysroot and -isysroot.
460
461 -imultilib dir
462 Use dir as a subdirectory of the directory containing target-
463 specific C++ headers.
464
465 -iprefix prefix
466 Specify prefix as the prefix for subsequent -iwithprefix options.
467 If the prefix represents a directory, you should include the final
468 '/'.
469
470 -isysroot dir
471 This option is like the --sysroot option, but applies only to
472 header files. See the --sysroot option for more information.
473
474 -iquote dir
475 Search dir only for header files requested with "#include "file"";
476 they are not searched for "#include <file>", before all directories
477 specified by -I and before the standard system directories. If dir
478 begins with "=", then the "=" will be replaced by the sysroot
479 prefix; see --sysroot and -isysroot.
480
481 -isystem dir
482 Search dir for header files, after all directories specified by -I
483 but before the standard system directories. Mark it as a system
484 directory, so that it gets the same special treatment as is applied
485 to the standard system directories. If dir begins with "=", then
486 the "=" will be replaced by the sysroot prefix; see --sysroot and
487 -isysroot.
488
489 -nostdinc
490 Do not search the standard system directories for header files.
491 Only the directories you have specified with -I options (and the
492 directory of the current file, if appropriate) are searched.
493
494 -undef
495 Do not predefine any system-specific or GCC-specific macros. The
496 standard predefined macros remain defined.
497
498 -Apredicate=answer
499 Make an assertion with the predicate predicate and answer answer.
500 This form is preferred to the older form -A predicate(answer),
501 which is still supported, because it does not use shell special
502 characters.
503
504 -A-predicate=answer
505 Cancel an assertion with the predicate predicate and answer answer.
506
507 -C Do not discard comments. All comments are passed through to the
508 output file, except for comments in processed directives, which are
509 deleted along with the directive.
510
511 You should be prepared for side effects when using -C; it causes
512 the preprocessor to treat comments as tokens in their own right.
513 For example, comments appearing at the start of what would be a
514 directive line have the effect of turning that line into an
515 ordinary source line, since the first token on the line is no
516 longer a '#'.
517
518 Warning: this currently handles C-Style comments only. The
519 preprocessor does not yet recognize Fortran-style comments.
520
521 -CC Do not discard comments, including during macro expansion. This is
522 like -C, except that comments contained within macros are also
523 passed through to the output file where the macro is expanded.
524
525 In addition to the side-effects of the -C option, the -CC option
526 causes all C++-style comments inside a macro to be converted to
527 C-style comments. This is to prevent later use of that macro from
528 inadvertently commenting out the remainder of the source line. The
529 -CC option is generally used to support lint comments.
530
531 Warning: this currently handles C- and C++-Style comments only. The
532 preprocessor does not yet recognize Fortran-style comments.
533
534 -Dname
535 Predefine name as a macro, with definition 1.
536
537 -Dname=definition
538 The contents of definition are tokenized and processed as if they
539 appeared during translation phase three in a '#define' directive.
540 In particular, the definition will be truncated by embedded newline
541 characters.
542
543 If you are invoking the preprocessor from a shell or shell-like
544 program you may need to use the shell's quoting syntax to protect
545 characters such as spaces that have a meaning in the shell syntax.
546
547 If you wish to define a function-like macro on the command line,
548 write its argument list with surrounding parentheses before the
549 equals sign (if any). Parentheses are meaningful to most shells, so
550 you will need to quote the option. With sh and csh,
551 "-D'name(args...)=definition'" works.
552
553 -D and -U options are processed in the order they are given on the
554 command line. All -imacros file and -include file options are
555 processed after all -D and -U options.
556
557 -H Print the name of each header file used, in addition to other
558 normal activities. Each name is indented to show how deep in the
559 '#include' stack it is.
560
561 -P Inhibit generation of linemarkers in the output from the
562 preprocessor. This might be useful when running the preprocessor
563 on something that is not C code, and will be sent to a program
564 which might be confused by the linemarkers.
565
566 -Uname
567 Cancel any previous definition of name, either built in or provided
568 with a -D option.
569
570 Options to request or suppress errors and warnings
571 Errors are diagnostic messages that report that the GNU Fortran
572 compiler cannot compile the relevant piece of source code. The
573 compiler will continue to process the program in an attempt to report
574 further errors to aid in debugging, but will not produce any compiled
575 output.
576
577 Warnings are diagnostic messages that report constructions which are
578 not inherently erroneous but which are risky or suggest there is likely
579 to be a bug in the program. Unless -Werror is specified, they do not
580 prevent compilation of the program.
581
582 You can request many specific warnings with options beginning -W, for
583 example -Wimplicit to request warnings on implicit declarations. Each
584 of these specific warning options also has a negative form beginning
585 -Wno- to turn off warnings; for example, -Wno-implicit. This manual
586 lists only one of the two forms, whichever is not the default.
587
588 These options control the amount and kinds of errors and warnings
589 produced by GNU Fortran:
590
591 -fmax-errors=n
592 Limits the maximum number of error messages to n, at which point
593 GNU Fortran bails out rather than attempting to continue processing
594 the source code. If n is 0, there is no limit on the number of
595 error messages produced.
596
597 -fsyntax-only
598 Check the code for syntax errors, but do not actually compile it.
599 This will generate module files for each module present in the
600 code, but no other output file.
601
602 -Wpedantic
603 -pedantic
604 Issue warnings for uses of extensions to Fortran. -pedantic also
605 applies to C-language constructs where they occur in GNU Fortran
606 source files, such as use of \e in a character constant within a
607 directive like "#include".
608
609 Valid Fortran programs should compile properly with or without this
610 option. However, without this option, certain GNU extensions and
611 traditional Fortran features are supported as well. With this
612 option, many of them are rejected.
613
614 Some users try to use -pedantic to check programs for conformance.
615 They soon find that it does not do quite what they want---it finds
616 some nonstandard practices, but not all. However, improvements to
617 GNU Fortran in this area are welcome.
618
619 This should be used in conjunction with -std=f95, -std=f2003,
620 -std=f2008 or -std=f2018.
621
622 -pedantic-errors
623 Like -pedantic, except that errors are produced rather than
624 warnings.
625
626 -Wall
627 Enables commonly used warning options pertaining to usage that we
628 recommend avoiding and that we believe are easy to avoid. This
629 currently includes -Waliasing, -Wampersand, -Wconversion,
630 -Wsurprising, -Wc-binding-type, -Wintrinsics-std, -Wtabs,
631 -Wintrinsic-shadow, -Wline-truncation, -Wtarget-lifetime,
632 -Winteger-division, -Wreal-q-constant, -Wunused and
633 -Wundefined-do-loop.
634
635 -Waliasing
636 Warn about possible aliasing of dummy arguments. Specifically, it
637 warns if the same actual argument is associated with a dummy
638 argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)"
639 in a call with an explicit interface.
640
641 The following example will trigger the warning.
642
643 interface
644 subroutine bar(a,b)
645 integer, intent(in) :: a
646 integer, intent(out) :: b
647 end subroutine
648 end interface
649 integer :: a
650
651 call bar(a,a)
652
653 -Wampersand
654 Warn about missing ampersand in continued character constants. The
655 warning is given with -Wampersand, -pedantic, -std=f95, -std=f2003,
656 -std=f2008 and -std=f2018. Note: With no ampersand given in a
657 continued character constant, GNU Fortran assumes continuation at
658 the first non-comment, non-whitespace character after the ampersand
659 that initiated the continuation.
660
661 -Warray-temporaries
662 Warn about array temporaries generated by the compiler. The
663 information generated by this warning is sometimes useful in
664 optimization, in order to avoid such temporaries.
665
666 -Wc-binding-type
667 Warn if the a variable might not be C interoperable. In
668 particular, warn if the variable has been declared using an
669 intrinsic type with default kind instead of using a kind parameter
670 defined for C interoperability in the intrinsic "ISO_C_Binding"
671 module. This option is implied by -Wall.
672
673 -Wcharacter-truncation
674 Warn when a character assignment will truncate the assigned string.
675
676 -Wline-truncation
677 Warn when a source code line will be truncated. This option is
678 implied by -Wall. For free-form source code, the default is
679 -Werror=line-truncation such that truncations are reported as
680 error.
681
682 -Wconversion
683 Warn about implicit conversions that are likely to change the value
684 of the expression after conversion. Implied by -Wall.
685
686 -Wconversion-extra
687 Warn about implicit conversions between different types and kinds.
688 This option does not imply -Wconversion.
689
690 -Wextra
691 Enables some warning options for usages of language features which
692 may be problematic. This currently includes -Wcompare-reals,
693 -Wunused-parameter and -Wdo-subscript.
694
695 -Wfrontend-loop-interchange
696 Warn when using -ffrontend-loop-interchange for performing loop
697 interchanges.
698
699 -Wimplicit-interface
700 Warn if a procedure is called without an explicit interface. Note
701 this only checks that an explicit interface is present. It does
702 not check that the declared interfaces are consistent across
703 program units.
704
705 -Wimplicit-procedure
706 Warn if a procedure is called that has neither an explicit
707 interface nor has been declared as "EXTERNAL".
708
709 -Winteger-division
710 Warn if a constant integer division truncates its result. As an
711 example, 3/5 evaluates to 0.
712
713 -Wintrinsics-std
714 Warn if gfortran finds a procedure named like an intrinsic not
715 available in the currently selected standard (with -std) and treats
716 it as "EXTERNAL" procedure because of this. -fall-intrinsics can
717 be used to never trigger this behavior and always link to the
718 intrinsic regardless of the selected standard.
719
720 -Wno-overwrite-recursive
721 Do not warn when -fno-automatic is used with -frecursive. Recursion
722 will be broken if the relevant local variables do not have the
723 attribute "AUTOMATIC" explicitly declared. This option can be used
724 to suppress the warning when it is known that recursion is not
725 broken. Useful for build environments that use -Werror.
726
727 -Wreal-q-constant
728 Produce a warning if a real-literal-constant contains a "q"
729 exponent-letter.
730
731 -Wsurprising
732 Produce a warning when "suspicious" code constructs are
733 encountered. While technically legal these usually indicate that
734 an error has been made.
735
736 This currently produces a warning under the following
737 circumstances:
738
739 * An INTEGER SELECT construct has a CASE that can never be
740 matched as its lower value is greater than its upper value.
741
742 * A LOGICAL SELECT construct has three CASE statements.
743
744 * A TRANSFER specifies a source that is shorter than the
745 destination.
746
747 * The type of a function result is declared more than once with
748 the same type. If -pedantic or standard-conforming mode is
749 enabled, this is an error.
750
751 * A "CHARACTER" variable is declared with negative length.
752
753 -Wtabs
754 By default, tabs are accepted as whitespace, but tabs are not
755 members of the Fortran Character Set. For continuation lines, a
756 tab followed by a digit between 1 and 9 is supported. -Wtabs will
757 cause a warning to be issued if a tab is encountered. Note, -Wtabs
758 is active for -pedantic, -std=f95, -std=f2003, -std=f2008,
759 -std=f2018 and -Wall.
760
761 -Wundefined-do-loop
762 Warn if a DO loop with step either 1 or -1 yields an underflow or
763 an overflow during iteration of an induction variable of the loop.
764 This option is implied by -Wall.
765
766 -Wunderflow
767 Produce a warning when numerical constant expressions are
768 encountered, which yield an UNDERFLOW during compilation. Enabled
769 by default.
770
771 -Wintrinsic-shadow
772 Warn if a user-defined procedure or module procedure has the same
773 name as an intrinsic; in this case, an explicit interface or
774 "EXTERNAL" or "INTRINSIC" declaration might be needed to get calls
775 later resolved to the desired intrinsic/procedure. This option is
776 implied by -Wall.
777
778 -Wuse-without-only
779 Warn if a "USE" statement has no "ONLY" qualifier and thus
780 implicitly imports all public entities of the used module.
781
782 -Wunused-dummy-argument
783 Warn about unused dummy arguments. This option is implied by -Wall.
784
785 -Wunused-parameter
786 Contrary to gcc's meaning of -Wunused-parameter, gfortran's
787 implementation of this option does not warn about unused dummy
788 arguments (see -Wunused-dummy-argument), but about unused
789 "PARAMETER" values. -Wunused-parameter is implied by -Wextra if
790 also -Wunused or -Wall is used.
791
792 -Walign-commons
793 By default, gfortran warns about any occasion of variables being
794 padded for proper alignment inside a "COMMON" block. This warning
795 can be turned off via -Wno-align-commons. See also -falign-commons.
796
797 -Wfunction-elimination
798 Warn if any calls to impure functions are eliminated by the
799 optimizations enabled by the -ffrontend-optimize option. This
800 option is implied by -Wextra.
801
802 -Wrealloc-lhs
803 Warn when the compiler might insert code to for allocation or
804 reallocation of an allocatable array variable of intrinsic type in
805 intrinsic assignments. In hot loops, the Fortran 2003 reallocation
806 feature may reduce the performance. If the array is already
807 allocated with the correct shape, consider using a whole-array
808 array-spec (e.g. "(:,:,:)") for the variable on the left-hand side
809 to prevent the reallocation check. Note that in some cases the
810 warning is shown, even if the compiler will optimize reallocation
811 checks away. For instance, when the right-hand side contains the
812 same variable multiplied by a scalar. See also -frealloc-lhs.
813
814 -Wrealloc-lhs-all
815 Warn when the compiler inserts code to for allocation or
816 reallocation of an allocatable variable; this includes scalars and
817 derived types.
818
819 -Wcompare-reals
820 Warn when comparing real or complex types for equality or
821 inequality. This option is implied by -Wextra.
822
823 -Wtarget-lifetime
824 Warn if the pointer in a pointer assignment might be longer than
825 the its target. This option is implied by -Wall.
826
827 -Wzerotrip
828 Warn if a "DO" loop is known to execute zero times at compile time.
829 This option is implied by -Wall.
830
831 -Wdo-subscript
832 Warn if an array subscript inside a DO loop could lead to an out-
833 of-bounds access even if the compiler cannot prove that the
834 statement is actually executed, in cases like
835
836 real a(3)
837 do i=1,4
838 if (condition(i)) then
839 a(i) = 1.2
840 end if
841 end do
842
843 This option is implied by -Wextra.
844
845 -Werror
846 Turns all warnings into errors.
847
848 Some of these have no effect when compiling programs written in
849 Fortran.
850
851 Options for debugging your program or GNU Fortran
852 GNU Fortran has various special options that are used for debugging
853 either your program or the GNU Fortran compiler.
854
855 -fdump-fortran-original
856 Output the internal parse tree after translating the source program
857 into internal representation. This option is mostly useful for
858 debugging the GNU Fortran compiler itself. The output generated by
859 this option might change between releases. This option may also
860 generate internal compiler errors for features which have only
861 recently been added.
862
863 -fdump-fortran-optimized
864 Output the parse tree after front-end optimization. Mostly useful
865 for debugging the GNU Fortran compiler itself. The output generated
866 by this option might change between releases. This option may also
867 generate internal compiler errors for features which have only
868 recently been added.
869
870 -fdump-parse-tree
871 Output the internal parse tree after translating the source program
872 into internal representation. Mostly useful for debugging the GNU
873 Fortran compiler itself. The output generated by this option might
874 change between releases. This option may also generate internal
875 compiler errors for features which have only recently been added.
876 This option is deprecated; use "-fdump-fortran-original" instead.
877
878 -fdebug-aux-vars
879 Renames internal variables created by the gfortran front end and
880 makes them accessible to a debugger. The name of the internal
881 variables then start with upper-case letters followed by an
882 underscore. This option is useful for debugging the compiler's
883 code generation together with "-fdump-tree-original" and enabling
884 debugging of the executable program by using "-g" or "-ggdb3".
885
886 -fdump-fortran-global
887 Output a list of the global identifiers after translating into
888 middle-end representation. Mostly useful for debugging the GNU
889 Fortran compiler itself. The output generated by this option might
890 change between releases. This option may also generate internal
891 compiler errors for features which have only recently been added.
892
893 -ffpe-trap=list
894 Specify a list of floating point exception traps to enable. On
895 most systems, if a floating point exception occurs and the trap for
896 that exception is enabled, a SIGFPE signal will be sent and the
897 program being aborted, producing a core file useful for debugging.
898 list is a (possibly empty) comma-separated list of the following
899 exceptions: invalid (invalid floating point operation, such as
900 "SQRT(-1.0)"), zero (division by zero), overflow (overflow in a
901 floating point operation), underflow (underflow in a floating point
902 operation), inexact (loss of precision during operation), and
903 denormal (operation performed on a denormal value). The first five
904 exceptions correspond to the five IEEE 754 exceptions, whereas the
905 last one (denormal) is not part of the IEEE 754 standard but is
906 available on some common architectures such as x86.
907
908 The first three exceptions (invalid, zero, and overflow) often
909 indicate serious errors, and unless the program has provisions for
910 dealing with these exceptions, enabling traps for these three
911 exceptions is probably a good idea.
912
913 If the option is used more than once in the command line, the lists
914 will be joined: '"ffpe-trap="list1 "ffpe-trap="list2' is equivalent
915 to "ffpe-trap="list1,list2.
916
917 Note that once enabled an exception cannot be disabled (no negative
918 form).
919
920 Many, if not most, floating point operations incur loss of
921 precision due to rounding, and hence the "ffpe-trap=inexact" is
922 likely to be uninteresting in practice.
923
924 By default no exception traps are enabled.
925
926 -ffpe-summary=list
927 Specify a list of floating-point exceptions, whose flag status is
928 printed to "ERROR_UNIT" when invoking "STOP" and "ERROR STOP".
929 list can be either none, all or a comma-separated list of the
930 following exceptions: invalid, zero, overflow, underflow, inexact
931 and denormal. (See -ffpe-trap for a description of the exceptions.)
932
933 If the option is used more than once in the command line, only the
934 last one will be used.
935
936 By default, a summary for all exceptions but inexact is shown.
937
938 -fno-backtrace
939 When a serious runtime error is encountered or a deadly signal is
940 emitted (segmentation fault, illegal instruction, bus error,
941 floating-point exception, and the other POSIX signals that have the
942 action core), the Fortran runtime library tries to output a
943 backtrace of the error. "-fno-backtrace" disables the backtrace
944 generation. This option only has influence for compilation of the
945 Fortran main program.
946
947 Options for directory search
948 These options affect how GNU Fortran searches for files specified by
949 the "INCLUDE" directive and where it searches for previously compiled
950 modules.
951
952 It also affects the search paths used by cpp when used to preprocess
953 Fortran source.
954
955 -Idir
956 These affect interpretation of the "INCLUDE" directive (as well as
957 of the "#include" directive of the cpp preprocessor).
958
959 Also note that the general behavior of -I and "INCLUDE" is pretty
960 much the same as of -I with "#include" in the cpp preprocessor,
961 with regard to looking for header.gcc files and other such things.
962
963 This path is also used to search for .mod files when previously
964 compiled modules are required by a "USE" statement.
965
966 -Jdir
967 This option specifies where to put .mod files for compiled modules.
968 It is also added to the list of directories to searched by an "USE"
969 statement.
970
971 The default is the current directory.
972
973 -fintrinsic-modules-path dir
974 This option specifies the location of pre-compiled intrinsic
975 modules, if they are not in the default location expected by the
976 compiler.
977
978 Influencing the linking step
979 These options come into play when the compiler links object files into
980 an executable output file. They are meaningless if the compiler is not
981 doing a link step.
982
983 -static-libgfortran
984 On systems that provide libgfortran as a shared and a static
985 library, this option forces the use of the static version. If no
986 shared version of libgfortran was built when the compiler was
987 configured, this option has no effect.
988
989 Influencing runtime behavior
990 These options affect the runtime behavior of programs compiled with GNU
991 Fortran.
992
993 -fconvert=conversion
994 Specify the representation of data for unformatted files. Valid
995 values for conversion are: native, the default; swap, swap between
996 big- and little-endian; big-endian, use big-endian representation
997 for unformatted files; little-endian, use little-endian
998 representation for unformatted files.
999
1000 This option has an effect only when used in the main program. The
1001 "CONVERT" specifier and the GFORTRAN_CONVERT_UNIT environment
1002 variable override the default specified by -fconvert.
1003
1004 -frecord-marker=length
1005 Specify the length of record markers for unformatted files. Valid
1006 values for length are 4 and 8. Default is 4. This is different
1007 from previous versions of gfortran, which specified a default
1008 record marker length of 8 on most systems. If you want to read or
1009 write files compatible with earlier versions of gfortran, use
1010 -frecord-marker=8.
1011
1012 -fmax-subrecord-length=length
1013 Specify the maximum length for a subrecord. The maximum permitted
1014 value for length is 2147483639, which is also the default. Only
1015 really useful for use by the gfortran testsuite.
1016
1017 -fsign-zero
1018 When enabled, floating point numbers of value zero with the sign
1019 bit set are written as negative number in formatted output and
1020 treated as negative in the "SIGN" intrinsic. -fno-sign-zero does
1021 not print the negative sign of zero values (or values rounded to
1022 zero for I/O) and regards zero as positive number in the "SIGN"
1023 intrinsic for compatibility with Fortran 77. The default is
1024 -fsign-zero.
1025
1026 Options for code generation conventions
1027 These machine-independent options control the interface conventions
1028 used in code generation.
1029
1030 Most of them have both positive and negative forms; the negative form
1031 of -ffoo would be -fno-foo. In the table below, only one of the forms
1032 is listed---the one which is not the default. You can figure out the
1033 other form by either removing no- or adding it.
1034
1035 -fno-automatic
1036 Treat each program unit (except those marked as RECURSIVE) as if
1037 the "SAVE" statement were specified for every local variable and
1038 array referenced in it. Does not affect common blocks. (Some
1039 Fortran compilers provide this option under the name -static or
1040 -save.) The default, which is -fautomatic, uses the stack for
1041 local variables smaller than the value given by
1042 -fmax-stack-var-size. Use the option -frecursive to use no static
1043 memory.
1044
1045 Local variables or arrays having an explicit "SAVE" attribute are
1046 silently ignored unless the -pedantic option is added.
1047
1048 -ff2c
1049 Generate code designed to be compatible with code generated by g77
1050 and f2c.
1051
1052 The calling conventions used by g77 (originally implemented in f2c)
1053 require functions that return type default "REAL" to actually
1054 return the C type "double", and functions that return type
1055 "COMPLEX" to return the values via an extra argument in the calling
1056 sequence that points to where to store the return value. Under the
1057 default GNU calling conventions, such functions simply return their
1058 results as they would in GNU C---default "REAL" functions return
1059 the C type "float", and "COMPLEX" functions return the GNU C type
1060 "complex". Additionally, this option implies the
1061 -fsecond-underscore option, unless -fno-second-underscore is
1062 explicitly requested.
1063
1064 This does not affect the generation of code that interfaces with
1065 the libgfortran library.
1066
1067 Caution: It is not a good idea to mix Fortran code compiled with
1068 -ff2c with code compiled with the default -fno-f2c calling
1069 conventions as, calling "COMPLEX" or default "REAL" functions
1070 between program parts which were compiled with different calling
1071 conventions will break at execution time.
1072
1073 Caution: This will break code which passes intrinsic functions of
1074 type default "REAL" or "COMPLEX" as actual arguments, as the
1075 library implementations use the -fno-f2c calling conventions.
1076
1077 -fno-underscoring
1078 Do not transform names of entities specified in the Fortran source
1079 file by appending underscores to them.
1080
1081 With -funderscoring in effect, GNU Fortran appends one underscore
1082 to external names with no underscores. This is done to ensure
1083 compatibility with code produced by many UNIX Fortran compilers.
1084
1085 Caution: The default behavior of GNU Fortran is incompatible with
1086 f2c and g77, please use the -ff2c option if you want object files
1087 compiled with GNU Fortran to be compatible with object code created
1088 with these tools.
1089
1090 Use of -fno-underscoring is not recommended unless you are
1091 experimenting with issues such as integration of GNU Fortran into
1092 existing system environments (vis-a-vis existing libraries, tools,
1093 and so on).
1094
1095 For example, with -funderscoring, and assuming that "j()" and
1096 "max_count()" are external functions while "my_var" and "lvar" are
1097 local variables, a statement like
1098
1099 I = J() + MAX_COUNT (MY_VAR, LVAR)
1100
1101 is implemented as something akin to:
1102
1103 i = j_() + max_count__(&my_var__, &lvar);
1104
1105 With -fno-underscoring, the same statement is implemented as:
1106
1107 i = j() + max_count(&my_var, &lvar);
1108
1109 Use of -fno-underscoring allows direct specification of user-
1110 defined names while debugging and when interfacing GNU Fortran code
1111 with other languages.
1112
1113 Note that just because the names match does not mean that the
1114 interface implemented by GNU Fortran for an external name matches
1115 the interface implemented by some other language for that same
1116 name. That is, getting code produced by GNU Fortran to link to
1117 code produced by some other compiler using this or any other method
1118 can be only a small part of the overall solution---getting the code
1119 generated by both compilers to agree on issues other than naming
1120 can require significant effort, and, unlike naming disagreements,
1121 linkers normally cannot detect disagreements in these other areas.
1122
1123 Also, note that with -fno-underscoring, the lack of appended
1124 underscores introduces the very real possibility that a user-
1125 defined external name will conflict with a name in a system
1126 library, which could make finding unresolved-reference bugs quite
1127 difficult in some cases---they might occur at program run time, and
1128 show up only as buggy behavior at run time.
1129
1130 In future versions of GNU Fortran we hope to improve naming and
1131 linking issues so that debugging always involves using the names as
1132 they appear in the source, even if the names as seen by the linker
1133 are mangled to prevent accidental linking between procedures with
1134 incompatible interfaces.
1135
1136 -fsecond-underscore
1137 By default, GNU Fortran appends an underscore to external names.
1138 If this option is used GNU Fortran appends two underscores to names
1139 with underscores and one underscore to external names with no
1140 underscores. GNU Fortran also appends two underscores to internal
1141 names with underscores to avoid naming collisions with external
1142 names.
1143
1144 This option has no effect if -fno-underscoring is in effect. It is
1145 implied by the -ff2c option.
1146
1147 Otherwise, with this option, an external name such as "MAX_COUNT"
1148 is implemented as a reference to the link-time external symbol
1149 "max_count__", instead of "max_count_". This is required for
1150 compatibility with g77 and f2c, and is implied by use of the -ff2c
1151 option.
1152
1153 -fcoarray=<keyword>
1154 none
1155 Disable coarray support; using coarray declarations and image-
1156 control statements will produce a compile-time error. (Default)
1157
1158 single
1159 Single-image mode, i.e. "num_images()" is always one.
1160
1161 lib Library-based coarray parallelization; a suitable GNU Fortran
1162 coarray library needs to be linked.
1163
1164 -fcheck=<keyword>
1165 Enable the generation of run-time checks; the argument shall be a
1166 comma-delimited list of the following keywords. Prefixing a check
1167 with no- disables it if it was activated by a previous
1168 specification.
1169
1170 all Enable all run-time test of -fcheck.
1171
1172 array-temps
1173 Warns at run time when for passing an actual argument a
1174 temporary array had to be generated. The information generated
1175 by this warning is sometimes useful in optimization, in order
1176 to avoid such temporaries.
1177
1178 Note: The warning is only printed once per location.
1179
1180 bits
1181 Enable generation of run-time checks for invalid arguments to
1182 the bit manipulation intrinsics.
1183
1184 bounds
1185 Enable generation of run-time checks for array subscripts and
1186 against the declared minimum and maximum values. It also
1187 checks array indices for assumed and deferred shape arrays
1188 against the actual allocated bounds and ensures that all string
1189 lengths are equal for character array constructors without an
1190 explicit typespec.
1191
1192 Some checks require that -fcheck=bounds is set for the
1193 compilation of the main program.
1194
1195 Note: In the future this may also include other forms of
1196 checking, e.g., checking substring references.
1197
1198 do Enable generation of run-time checks for invalid modification
1199 of loop iteration variables.
1200
1201 mem Enable generation of run-time checks for memory allocation.
1202 Note: This option does not affect explicit allocations using
1203 the "ALLOCATE" statement, which will be always checked.
1204
1205 pointer
1206 Enable generation of run-time checks for pointers and
1207 allocatables.
1208
1209 recursion
1210 Enable generation of run-time checks for recursively called
1211 subroutines and functions which are not marked as recursive.
1212 See also -frecursive. Note: This check does not work for
1213 OpenMP programs and is disabled if used together with
1214 -frecursive and -fopenmp.
1215
1216 Example: Assuming you have a file foo.f90, the command
1217
1218 gfortran -fcheck=all,no-array-temps foo.f90
1219
1220 will compile the file with all checks enabled as specified above
1221 except warnings for generated array temporaries.
1222
1223 -fbounds-check
1224 Deprecated alias for -fcheck=bounds.
1225
1226 -ftail-call-workaround
1227 -ftail-call-workaround=n
1228 Some C interfaces to Fortran codes violate the gfortran ABI by
1229 omitting the hidden character length arguments as described in
1230 This can lead to crashes because pushing arguments for tail calls
1231 can overflow the stack.
1232
1233 To provide a workaround for existing binary packages, this option
1234 disables tail call optimization for gfortran procedures with
1235 character arguments. With -ftail-call-workaround=2 tail call
1236 optimization is disabled in all gfortran procedures with character
1237 arguments, with -ftail-call-workaround=1 or equivalent
1238 -ftail-call-workaround only in gfortran procedures with character
1239 arguments that call implicitly prototyped procedures.
1240
1241 Using this option can lead to problems including crashes due to
1242 insufficient stack space.
1243
1244 It is very strongly recommended to fix the code in question. The
1245 -fc-prototypes-external option can be used to generate prototypes
1246 which conform to gfortran's ABI, for inclusion in the source code.
1247
1248 Support for this option will likely be withdrawn in a future
1249 release of gfortran.
1250
1251 The negative form, -fno-tail-call-workaround or equivalent
1252 -ftail-call-workaround=0, can be used to disable this option.
1253
1254 Default is currently -ftail-call-workaround, this will change in
1255 future releases.
1256
1257 -fcheck-array-temporaries
1258 Deprecated alias for -fcheck=array-temps.
1259
1260 -fmax-array-constructor=n
1261 This option can be used to increase the upper limit permitted in
1262 array constructors. The code below requires this option to expand
1263 the array at compile time.
1264
1265 program test
1266 implicit none
1267 integer j
1268 integer, parameter :: n = 100000
1269 integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)
1270 print '(10(I0,1X))', i
1271 end program test
1272
1273 Caution: This option can lead to long compile times and
1274 excessively large object files.
1275
1276 The default value for n is 65535.
1277
1278 -fmax-stack-var-size=n
1279 This option specifies the size in bytes of the largest array that
1280 will be put on the stack; if the size is exceeded static memory is
1281 used (except in procedures marked as RECURSIVE). Use the option
1282 -frecursive to allow for recursive procedures which do not have a
1283 RECURSIVE attribute or for parallel programs. Use -fno-automatic to
1284 never use the stack.
1285
1286 This option currently only affects local arrays declared with
1287 constant bounds, and may not apply to all character variables.
1288 Future versions of GNU Fortran may improve this behavior.
1289
1290 The default value for n is 65536.
1291
1292 -fstack-arrays
1293 Adding this option will make the Fortran compiler put all arrays of
1294 unknown size and array temporaries onto stack memory. If your
1295 program uses very large local arrays it is possible that you will
1296 have to extend your runtime limits for stack memory on some
1297 operating systems. This flag is enabled by default at optimization
1298 level -Ofast unless -fmax-stack-var-size is specified.
1299
1300 -fpack-derived
1301 This option tells GNU Fortran to pack derived type members as
1302 closely as possible. Code compiled with this option is likely to
1303 be incompatible with code compiled without this option, and may
1304 execute slower.
1305
1306 -frepack-arrays
1307 In some circumstances GNU Fortran may pass assumed shape array
1308 sections via a descriptor describing a noncontiguous area of
1309 memory. This option adds code to the function prologue to repack
1310 the data into a contiguous block at runtime.
1311
1312 This should result in faster accesses to the array. However it can
1313 introduce significant overhead to the function call, especially
1314 when the passed data is noncontiguous.
1315
1316 -fshort-enums
1317 This option is provided for interoperability with C code that was
1318 compiled with the -fshort-enums option. It will make GNU Fortran
1319 choose the smallest "INTEGER" kind a given enumerator set will fit
1320 in, and give all its enumerators this kind.
1321
1322 -finline-arg-packing
1323 When passing an assumed-shape argument of a procedure as actual
1324 argument to an assumed-size or explicit size or as argument to a
1325 procedure that does not have an explicit interface, the argument
1326 may have to be packed, that is put into contiguous memory. An
1327 example is the call to "foo" in
1328
1329 subroutine foo(a)
1330 real, dimension(*) :: a
1331 end subroutine foo
1332 subroutine bar(b)
1333 real, dimension(:) :: b
1334 call foo(b)
1335 end subroutine bar
1336
1337 When -finline-arg-packing is in effect, this packing will be
1338 performed by inline code. This allows for more optimization while
1339 increasing code size.
1340
1341 -finline-arg-packing is implied by any of the -O options except
1342 when optimizing for size via -Os. If the code contains a very
1343 large number of argument that have to be packed, code size and also
1344 compilation time may become excessive. If that is the case, it may
1345 be better to disable this option. Instances of packing can be
1346 found by using by using -Warray-temporaries.
1347
1348 -fexternal-blas
1349 This option will make gfortran generate calls to BLAS functions for
1350 some matrix operations like "MATMUL", instead of using our own
1351 algorithms, if the size of the matrices involved is larger than a
1352 given limit (see -fblas-matmul-limit). This may be profitable if
1353 an optimized vendor BLAS library is available. The BLAS library
1354 will have to be specified at link time.
1355
1356 -fblas-matmul-limit=n
1357 Only significant when -fexternal-blas is in effect. Matrix
1358 multiplication of matrices with size larger than (or equal to) n
1359 will be performed by calls to BLAS functions, while others will be
1360 handled by gfortran internal algorithms. If the matrices involved
1361 are not square, the size comparison is performed using the
1362 geometric mean of the dimensions of the argument and result
1363 matrices.
1364
1365 The default value for n is 30.
1366
1367 -finline-matmul-limit=n
1368 When front-end optimization is active, some calls to the "MATMUL"
1369 intrinsic function will be inlined. This may result in code size
1370 increase if the size of the matrix cannot be determined at compile
1371 time, as code for both cases is generated. Setting
1372 "-finline-matmul-limit=0" will disable inlining in all cases.
1373 Setting this option with a value of n will produce inline code for
1374 matrices with size up to n. If the matrices involved are not
1375 square, the size comparison is performed using the geometric mean
1376 of the dimensions of the argument and result matrices.
1377
1378 The default value for n is 30. The "-fblas-matmul-limit" can be
1379 used to change this value.
1380
1381 -frecursive
1382 Allow indirect recursion by forcing all local arrays to be
1383 allocated on the stack. This flag cannot be used together with
1384 -fmax-stack-var-size= or -fno-automatic.
1385
1386 -finit-local-zero
1387 -finit-derived
1388 -finit-integer=n
1389 -finit-real=<zero|inf|-inf|nan|snan>
1390 -finit-logical=<true|false>
1391 -finit-character=n
1392 The -finit-local-zero option instructs the compiler to initialize
1393 local "INTEGER", "REAL", and "COMPLEX" variables to zero, "LOGICAL"
1394 variables to false, and "CHARACTER" variables to a string of null
1395 bytes. Finer-grained initialization options are provided by the
1396 -finit-integer=n, -finit-real=<zero|inf|-inf|nan|snan> (which also
1397 initializes the real and imaginary parts of local "COMPLEX"
1398 variables), -finit-logical=<true|false>, and -finit-character=n
1399 (where n is an ASCII character value) options.
1400
1401 With -finit-derived, components of derived type variables will be
1402 initialized according to these flags. Components whose type is not
1403 covered by an explicit -finit-* flag will be treated as described
1404 above with -finit-local-zero.
1405
1406 These options do not initialize
1407
1408 * objects with the POINTER attribute
1409
1410 * allocatable arrays
1411
1412 * variables that appear in an "EQUIVALENCE" statement.
1413
1414 (These limitations may be removed in future releases).
1415
1416 Note that the -finit-real=nan option initializes "REAL" and
1417 "COMPLEX" variables with a quiet NaN. For a signalling NaN use
1418 -finit-real=snan; note, however, that compile-time optimizations
1419 may convert them into quiet NaN and that trapping needs to be
1420 enabled (e.g. via -ffpe-trap).
1421
1422 The -finit-integer option will parse the value into an integer of
1423 type "INTEGER(kind=C_LONG)" on the host. Said value is then
1424 assigned to the integer variables in the Fortran code, which might
1425 result in wraparound if the value is too large for the kind.
1426
1427 Finally, note that enabling any of the -finit-* options will
1428 silence warnings that would have been emitted by -Wuninitialized
1429 for the affected local variables.
1430
1431 -falign-commons
1432 By default, gfortran enforces proper alignment of all variables in
1433 a "COMMON" block by padding them as needed. On certain platforms
1434 this is mandatory, on others it increases performance. If a
1435 "COMMON" block is not declared with consistent data types
1436 everywhere, this padding can cause trouble, and -fno-align-commons
1437 can be used to disable automatic alignment. The same form of this
1438 option should be used for all files that share a "COMMON" block.
1439 To avoid potential alignment issues in "COMMON" blocks, it is
1440 recommended to order objects from largest to smallest.
1441
1442 -fno-protect-parens
1443 By default the parentheses in expression are honored for all
1444 optimization levels such that the compiler does not do any re-
1445 association. Using -fno-protect-parens allows the compiler to
1446 reorder "REAL" and "COMPLEX" expressions to produce faster code.
1447 Note that for the re-association optimization -fno-signed-zeros and
1448 -fno-trapping-math need to be in effect. The parentheses protection
1449 is enabled by default, unless -Ofast is given.
1450
1451 -frealloc-lhs
1452 An allocatable left-hand side of an intrinsic assignment is
1453 automatically (re)allocated if it is either unallocated or has a
1454 different shape. The option is enabled by default except when
1455 -std=f95 is given. See also -Wrealloc-lhs.
1456
1457 -faggressive-function-elimination
1458 Functions with identical argument lists are eliminated within
1459 statements, regardless of whether these functions are marked "PURE"
1460 or not. For example, in
1461
1462 a = f(b,c) + f(b,c)
1463
1464 there will only be a single call to "f". This option only works if
1465 -ffrontend-optimize is in effect.
1466
1467 -ffrontend-optimize
1468 This option performs front-end optimization, based on manipulating
1469 parts the Fortran parse tree. Enabled by default by any -O option
1470 except -O0 and -Og. Optimizations enabled by this option include:
1471
1472 *<inlining calls to "MATMUL",>
1473 *<elimination of identical function calls within expressions,>
1474 *<removing unnecessary calls to "TRIM" in comparisons and
1475 assignments,>
1476 *<replacing TRIM(a) with "a(1:LEN_TRIM(a))" and>
1477 *<short-circuiting of logical operators (".AND." and ".OR.").>
1478
1479 It can be deselected by specifying -fno-frontend-optimize.
1480
1481 -ffrontend-loop-interchange
1482 Attempt to interchange loops in the Fortran front end where
1483 profitable. Enabled by default by any -O option. At the moment,
1484 this option only affects "FORALL" and "DO CONCURRENT" statements
1485 with several forall triplets.
1486
1488 The gfortran compiler currently does not make use of any environment
1489 variables to control its operation above and beyond those that affect
1490 the operation of gcc.
1491
1493 For instructions on reporting bugs, see
1494 <http://bugzilla.redhat.com/bugzilla>.
1495
1497 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), gcc(1), as(1), ld(1),
1498 gdb(1), dbx(1) and the Info entries for gcc, cpp, gfortran, as, ld,
1499 binutils and gdb.
1500
1502 See the Info entry for gfortran for contributors to GCC and GNU
1503 Fortran.
1504
1506 Copyright (c) 2004-2021 Free Software Foundation, Inc.
1507
1508 Permission is granted to copy, distribute and/or modify this document
1509 under the terms of the GNU Free Documentation License, Version 1.3 or
1510 any later version published by the Free Software Foundation; with the
1511 Invariant Sections being "Funding Free Software", the Front-Cover Texts
1512 being (a) (see below), and with the Back-Cover Texts being (b) (see
1513 below). A copy of the license is included in the gfdl(7) man page.
1514
1515 (a) The FSF's Front-Cover Text is:
1516
1517 A GNU Manual
1518
1519 (b) The FSF's Back-Cover Text is:
1520
1521 You have freedom to copy and modify this GNU Manual, like GNU
1522 software. Copies published by the Free Software Foundation raise
1523 funds for GNU development.
1524
1525
1526
1527gcc-11.2.1 2021-07-28 GFORTRAN(1)