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