Mercurial > hg > CbC > CbC_gcc
comparison gcc/fortran/invoke.texi @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 @c Copyright (C) 2004-2018 Free Software Foundation, Inc. | 1 @c Copyright (C) 2004-2020 Free Software Foundation, Inc. |
2 @c This is part of the GNU Fortran manual. | 2 @c This is part of the GNU Fortran manual. |
3 @c For copying conditions, see the file gfortran.texi. | 3 @c For copying conditions, see the file gfortran.texi. |
4 | 4 |
5 @ignore | 5 @ignore |
6 @c man begin COPYRIGHT | 6 @c man begin COPYRIGHT |
7 Copyright @copyright{} 2004-2018 Free Software Foundation, Inc. | 7 Copyright @copyright{} 2004-2020 Free Software Foundation, Inc. |
8 | 8 |
9 Permission is granted to copy, distribute and/or modify this document | 9 Permission is granted to copy, distribute and/or modify this document |
10 under the terms of the GNU Free Documentation License, Version 1.3 or | 10 under the terms of the GNU Free Documentation License, Version 1.3 or |
11 any later version published by the Free Software Foundation; with the | 11 any later version published by the Free Software Foundation; with the |
12 Invariant Sections being ``Funding Free Software'', the Front-Cover | 12 Invariant Sections being ``Funding Free Software'', the Front-Cover |
114 by type. Explanations are in the following sections. | 114 by type. Explanations are in the following sections. |
115 | 115 |
116 @table @emph | 116 @table @emph |
117 @item Fortran Language Options | 117 @item Fortran Language Options |
118 @xref{Fortran Dialect Options,,Options controlling Fortran dialect}. | 118 @xref{Fortran Dialect Options,,Options controlling Fortran dialect}. |
119 @gccoptlist{-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code @gol | 119 @gccoptlist{-fall-intrinsics -fallow-argument-mismatch -fallow-invalid-boz @gol |
120 -fd-lines-as-comments @gol | 120 -fbackslash -fcray-pointer -fd-lines-as-code -fd-lines-as-comments @gol |
121 -fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math @gol | 121 -fdec -fdec-char-conversions -fdec-structure -fdec-intrinsic-ints @gol |
122 -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol | 122 -fdec-static -fdec-math -fdec-include -fdec-format-defaults @gol |
123 -fdefault-real-10 -fdefault-real-16 -fdollar-ok -ffixed-line-length-@var{n} @gol | 123 -fdec-blank-format-item -fdefault-double-8 -fdefault-integer-8 @gol |
124 -ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol | 124 -fdefault-real-8 -fdefault-real-10 -fdefault-real-16 -fdollar-ok @gol |
125 -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol | 125 -ffixed-line-length-@var{n} -ffixed-line-length-none -fpad-source @gol |
126 -fmax-identifier-length -fmodule-private -ffixed-form -fno-range-check @gol | 126 -ffree-form -ffree-line-length-@var{n} -ffree-line-length-none @gol |
127 -fopenacc -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 @gol | 127 -fimplicit-none -finteger-4-integer-8 -fmax-identifier-length @gol |
128 -freal-8-real-10 -freal-8-real-16 -freal-8-real-4 -std=@var{std} | 128 -fmodule-private -ffixed-form -fno-range-check -fopenacc -fopenmp @gol |
129 -ftest-forall-temp | 129 -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 -freal-8-real-10 @gol |
130 -freal-8-real-16 -freal-8-real-4 -std=@var{std} -ftest-forall-temp | |
130 } | 131 } |
131 | 132 |
132 @item Preprocessing Options | 133 @item Preprocessing Options |
133 @xref{Preprocessing Options,,Enable and customize preprocessing}. | 134 @xref{Preprocessing Options,,Enable and customize preprocessing}. |
134 @gccoptlist{-A-@var{question}@r{[}=@var{answer}@r{]} | 135 @gccoptlist{-A-@var{question}@r{[}=@var{answer}@r{]} |
142 } | 143 } |
143 | 144 |
144 @item Error and Warning Options | 145 @item Error and Warning Options |
145 @xref{Error and Warning Options,,Options to request or suppress errors | 146 @xref{Error and Warning Options,,Options to request or suppress errors |
146 and warnings}. | 147 and warnings}. |
147 @gccoptlist{-Waliasing -Wall -Wampersand -Wargument-mismatch -Warray-bounds | 148 @gccoptlist{-Waliasing -Wall -Wampersand -Warray-bounds @gol |
148 -Wc-binding-type -Wcharacter-truncation -Wconversion @gol | 149 -Wc-binding-type -Wcharacter-truncation -Wconversion @gol |
149 -Wdo-subscript -Wfunction-elimination -Wimplicit-interface @gol | 150 -Wdo-subscript -Wfunction-elimination -Wimplicit-interface @gol |
150 -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only -Wintrinsics-std @gol | 151 -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only @gol |
151 -Wline-truncation -Wno-align-commons -Wno-tabs -Wreal-q-constant @gol | 152 -Wintrinsics-std -Wline-truncation -Wno-align-commons @gol |
152 -Wsurprising -Wunderflow -Wunused-parameter -Wrealloc-lhs @gol | 153 -Wno-overwrite-recursive -Wno-tabs -Wreal-q-constant -Wsurprising @gol |
153 -Wrealloc-lhs-all -Wfrontend-loop-interchange -Wtarget-lifetime @gol | 154 -Wunderflow -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all @gol |
154 -fmax-errors=@var{n} -fsyntax-only -pedantic -pedantic-errors @gol | 155 -Wfrontend-loop-interchange -Wtarget-lifetime -fmax-errors=@var{n} @gol |
156 -fsyntax-only -pedantic @gol | |
157 -pedantic-errors @gol | |
155 } | 158 } |
156 | 159 |
157 @item Debugging Options | 160 @item Debugging Options |
158 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}. | 161 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}. |
159 @gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original @gol | 162 @gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original @gol |
160 -fdump-parse-tree -ffpe-trap=@var{list} -ffpe-summary=@var{list} | 163 -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} @gol |
164 -ffpe-summary=@var{list} | |
161 } | 165 } |
162 | 166 |
163 @item Directory Options | 167 @item Directory Options |
164 @xref{Directory Options,,Options for directory search}. | 168 @xref{Directory Options,,Options for directory search}. |
165 @gccoptlist{-I@var{dir} -J@var{dir} -fintrinsic-modules-path @var{dir}} | 169 @gccoptlist{-I@var{dir} -J@var{dir} -fintrinsic-modules-path @var{dir}} |
174 -frecord-marker=@var{length} -fsign-zero | 178 -frecord-marker=@var{length} -fsign-zero |
175 } | 179 } |
176 | 180 |
177 @item Interoperability Options | 181 @item Interoperability Options |
178 @xref{Interoperability Options,,Options for interoperability}. | 182 @xref{Interoperability Options,,Options for interoperability}. |
179 @gccoptlist{-fc-prototypes} | 183 @gccoptlist{-fc-prototypes -fc-prototypes-external} |
180 | 184 |
181 @item Code Generation Options | 185 @item Code Generation Options |
182 @xref{Code Gen Options,,Options for code generation conventions}. | 186 @xref{Code Gen Options,,Options for code generation conventions}. |
183 @gccoptlist{-faggressive-function-elimination -fblas-matmul-limit=@var{n} @gol | 187 @gccoptlist{-faggressive-function-elimination -fblas-matmul-limit=@var{n} @gol |
184 -fbounds-check -fcheck-array-temporaries @gol | 188 -fbounds-check -ftail-call-workaround -ftail-call-workaround=@var{n} @gol |
185 -fcheck=@var{<all|array-temps|bounds|do|mem|pointer|recursion>} @gol | 189 -fcheck-array-temporaries @gol |
186 -fcoarray=@var{<none|single|lib>} -fexternal-blas -ff2c | 190 -fcheck=@var{<all|array-temps|bits|bounds|do|mem|pointer|recursion>} @gol |
187 -ffrontend-loop-interchange @gol | 191 -fcoarray=@var{<none|single|lib>} -fexternal-blas -ff2c @gol |
188 -ffrontend-optimize @gol | 192 -ffrontend-loop-interchange -ffrontend-optimize @gol |
189 -finit-character=@var{n} -finit-integer=@var{n} -finit-local-zero @gol | 193 -finit-character=@var{n} -finit-integer=@var{n} -finit-local-zero @gol |
190 -finit-derived @gol | 194 -finit-derived -finit-logical=@var{<true|false>} @gol |
191 -finit-logical=@var{<true|false>} | 195 -finit-real=@var{<zero|inf|-inf|nan|snan>} |
192 -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol | |
193 -finline-matmul-limit=@var{n} @gol | 196 -finline-matmul-limit=@var{n} @gol |
194 -fmax-array-constructor=@var{n} -fmax-stack-var-size=@var{n} | 197 -finline-arg-packing -fmax-array-constructor=@var{n} @gol |
195 -fno-align-commons @gol | 198 -fmax-stack-var-size=@var{n} -fno-align-commons -fno-automatic @gol |
196 -fno-automatic -fno-protect-parens -fno-underscoring @gol | 199 -fno-protect-parens -fno-underscoring -fsecond-underscore @gol |
197 -fsecond-underscore -fpack-derived -frealloc-lhs -frecursive @gol | 200 -fpack-derived -frealloc-lhs -frecursive -frepack-arrays @gol |
198 -frepack-arrays -fshort-enums -fstack-arrays | 201 -fshort-enums -fstack-arrays |
199 } | 202 } |
200 @end table | 203 @end table |
201 | 204 |
202 @node Fortran Dialect Options | 205 @node Fortran Dialect Options |
203 @section Options controlling Fortran dialect | 206 @section Options controlling Fortran dialect |
228 force standard-compliance but get access to the full range of intrinsics | 231 force standard-compliance but get access to the full range of intrinsics |
229 available with @command{gfortran}. As a consequence, @option{-Wintrinsics-std} | 232 available with @command{gfortran}. As a consequence, @option{-Wintrinsics-std} |
230 will be ignored and no user-defined procedure with the same name as any | 233 will be ignored and no user-defined procedure with the same name as any |
231 intrinsic will be called except when it is explicitly declared @code{EXTERNAL}. | 234 intrinsic will be called except when it is explicitly declared @code{EXTERNAL}. |
232 | 235 |
236 @item -fallow-argument-mismatch | |
237 @opindex @code{fallow-argument-mismatch} | |
238 Some code contains calls to external procedures whith mismatches | |
239 between the calls and the procedure definition, or with mismatches | |
240 between different calls. Such code is non-conforming, and will usually | |
241 be flagged wi1th an error. This options degrades the error to a | |
242 warning, which can only be disabled by disabling all warnings vial | |
243 @option{-w}. Only a single occurrence per argument is flagged by this | |
244 warning. @option{-fallow-argument-mismatch} is implied by | |
245 @option{-std=legacy}. | |
246 | |
247 Using this option is @emph{strongly} discouraged. It is possible to | |
248 provide standard-conforming code which allows different types of | |
249 arguments by using an explicit interface and @code{TYPE(*)}. | |
250 | |
251 @item -fallow-invalid-boz | |
252 @opindex @code{allow-invalid-boz} | |
253 A BOZ literal constant can occur in a limited number of contexts in | |
254 standard conforming Fortran. This option degrades an error condition | |
255 to a warning, and allows a BOZ literal constant to appear where the | |
256 Fortran standard would otherwise prohibit its use. | |
257 | |
233 @item -fd-lines-as-code | 258 @item -fd-lines-as-code |
234 @itemx -fd-lines-as-comments | 259 @itemx -fd-lines-as-comments |
235 @opindex @code{fd-lines-as-code} | 260 @opindex @code{fd-lines-as-code} |
236 @opindex @code{fd-lines-as-comments} | 261 @opindex @code{fd-lines-as-comments} |
237 Enable special treatment for lines beginning with @code{d} or @code{D} | 262 Enable special treatment for lines beginning with @code{d} or @code{D} |
247 These features are non-standard and should be avoided at all costs. | 272 These features are non-standard and should be avoided at all costs. |
248 For details on GNU Fortran's implementation of these extensions see the | 273 For details on GNU Fortran's implementation of these extensions see the |
249 full documentation. | 274 full documentation. |
250 | 275 |
251 Other flags enabled by this switch are: | 276 Other flags enabled by this switch are: |
252 @option{-fdollar-ok} @option{-fcray-pointer} @option{-fdec-structure} | 277 @option{-fdollar-ok} @option{-fcray-pointer} @option{-fdec-char-conversions} |
253 @option{-fdec-intrinsic-ints} @option{-fdec-static} @option{-fdec-math} | 278 @option{-fdec-structure} @option{-fdec-intrinsic-ints} @option{-fdec-static} |
279 @option{-fdec-math} @option{-fdec-include} @option{-fdec-blank-format-item} | |
280 @option{-fdec-format-defaults} | |
254 | 281 |
255 If @option{-fd-lines-as-code}/@option{-fd-lines-as-comments} are unset, then | 282 If @option{-fd-lines-as-code}/@option{-fd-lines-as-comments} are unset, then |
256 @option{-fdec} also sets @option{-fd-lines-as-comments}. | 283 @option{-fdec} also sets @option{-fd-lines-as-comments}. |
284 | |
285 @item -fdec-char-conversions | |
286 @opindex @code{fdec-char-conversions} | |
287 Enable the use of character literals in assignments and @code{DATA} statements | |
288 for non-character variables. | |
257 | 289 |
258 @item -fdec-structure | 290 @item -fdec-structure |
259 @opindex @code{fdec-structure} | 291 @opindex @code{fdec-structure} |
260 Enable DEC @code{STRUCTURE} and @code{RECORD} as well as @code{UNION}, | 292 Enable DEC @code{STRUCTURE} and @code{RECORD} as well as @code{UNION}, |
261 @code{MAP}, and dot ('.') as a member separator (in addition to '%'). This is | 293 @code{MAP}, and dot ('.') as a member separator (in addition to '%'). This is |
274 | 306 |
275 @item -fdec-static | 307 @item -fdec-static |
276 @opindex @code{fdec-static} | 308 @opindex @code{fdec-static} |
277 Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specify | 309 Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specify |
278 the storage of variables and other objects. | 310 the storage of variables and other objects. |
311 | |
312 @item -fdec-include | |
313 @opindex @code{fdec-include} | |
314 Enable parsing of INCLUDE as a statement in addition to parsing it as | |
315 INCLUDE line. When parsed as INCLUDE statement, INCLUDE does not have to | |
316 be on a single line and can use line continuations. | |
317 | |
318 @item -fdec-format-defaults | |
319 @opindex @code{fdec-format-defaults} | |
320 Enable format specifiers F, G and I to be used without width specifiers, | |
321 default widths will be used instead. | |
322 | |
323 @item -fdec-blank-format-item | |
324 @opindex @code{fdec-blank-format-item} | |
325 Enable a blank format item at the end of a format specification i.e. nothing | |
326 following the final comma. | |
279 | 327 |
280 @item -fdollar-ok | 328 @item -fdollar-ok |
281 @opindex @code{fdollar-ok} | 329 @opindex @code{fdollar-ok} |
282 @cindex @code{$} | 330 @cindex @code{$} |
283 @cindex symbol names | 331 @cindex symbol names |
313 | 361 |
314 @item -ffixed-line-length-@var{n} | 362 @item -ffixed-line-length-@var{n} |
315 @opindex @code{ffixed-line-length-}@var{n} | 363 @opindex @code{ffixed-line-length-}@var{n} |
316 @cindex file format, fixed | 364 @cindex file format, fixed |
317 Set column after which characters are ignored in typical fixed-form | 365 Set column after which characters are ignored in typical fixed-form |
318 lines in the source file, and through which spaces are assumed (as | 366 lines in the source file, and, unless @code{-fno-pad-source}, through which |
319 if padded to that length) after the ends of short fixed-form lines. | 367 spaces are assumed (as if padded to that length) after the ends of short |
368 fixed-form lines. | |
320 | 369 |
321 Popular values for @var{n} include 72 (the | 370 Popular values for @var{n} include 72 (the |
322 standard and the default), 80 (card image), and 132 (corresponding | 371 standard and the default), 80 (card image), and 132 (corresponding |
323 to ``extended-source'' options in some popular compilers). | 372 to ``extended-source'' options in some popular compilers). |
324 @var{n} may also be @samp{none}, meaning that the entire line is meaningful | 373 @var{n} may also be @samp{none}, meaning that the entire line is meaningful |
325 and that continued character constants never have implicit spaces appended | 374 and that continued character constants never have implicit spaces appended |
326 to them to fill out the line. | 375 to them to fill out the line. |
327 @option{-ffixed-line-length-0} means the same thing as | 376 @option{-ffixed-line-length-0} means the same thing as |
328 @option{-ffixed-line-length-none}. | 377 @option{-ffixed-line-length-none}. |
378 | |
379 @item -fno-pad-source | |
380 @opindex @code{fpad-source} | |
381 By default fixed-form lines have spaces assumed (as if padded to that length) | |
382 after the ends of short fixed-form lines. This is not done either if | |
383 @option{-ffixed-line-length-0}, @option{-ffixed-line-length-none} or | |
384 if @option{-fno-pad-source} option is used. With any of those options | |
385 continued character constants never have implicit spaces appended | |
386 to them to fill out the line. | |
329 | 387 |
330 @item -ffree-line-length-@var{n} | 388 @item -ffree-line-length-@var{n} |
331 @opindex @code{ffree-line-length-}@var{n} | 389 @opindex @code{ffree-line-length-}@var{n} |
332 @cindex file format, free | 390 @cindex file format, free |
333 Set column after which characters are ignored in typical free-form | 391 Set column after which characters are ignored in typical free-form |
359 directives in free form and @code{c$acc}, @code{*$acc} and | 417 directives in free form and @code{c$acc}, @code{*$acc} and |
360 @code{!$acc} directives in fixed form, @code{!$} conditional | 418 @code{!$acc} directives in fixed form, @code{!$} conditional |
361 compilation sentinels in free form and @code{c$}, @code{*$} and | 419 compilation sentinels in free form and @code{c$}, @code{*$} and |
362 @code{!$} sentinels in fixed form, and when linking arranges for the | 420 @code{!$} sentinels in fixed form, and when linking arranges for the |
363 OpenACC runtime library to be linked in. | 421 OpenACC runtime library to be linked in. |
364 | |
365 Note that this is an experimental feature, incomplete, and subject to | |
366 change in future versions of GCC. See | |
367 @w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information. | |
368 | 422 |
369 @item -fopenmp | 423 @item -fopenmp |
370 @opindex @code{fopenmp} | 424 @opindex @code{fopenmp} |
371 @cindex OpenMP | 425 @cindex OpenMP |
372 Enable the OpenMP extensions. This includes OpenMP @code{!$omp} directives | 426 Enable the OpenMP extensions. This includes OpenMP @code{!$omp} directives |
398 @option{-finteger-4-integer-8}, it does not promote variables with explicit | 452 @option{-finteger-4-integer-8}, it does not promote variables with explicit |
399 kind declaration. | 453 kind declaration. |
400 | 454 |
401 @item -fdefault-real-8 | 455 @item -fdefault-real-8 |
402 @opindex @code{fdefault-real-8} | 456 @opindex @code{fdefault-real-8} |
403 Set the default real type to an 8 byte wide type. This option also affects | 457 Set the default real type to an 8 byte wide type. This option also affects |
404 the kind of non-double real constants like @code{1.0}, and does promote | 458 the kind of non-double real constants like @code{1.0}. This option promotes |
405 the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless | 459 the default width of @code{DOUBLE PRECISION} and double real constants |
406 @code{-fdefault-double-8} is given, too. Unlike @option{-freal-4-real-8}, | 460 like @code{1.d0} to 16 bytes if possible. If @code{-fdefault-double-8} |
407 it does not promote variables with explicit kind declaration. | 461 is given along with @code{fdefault-real-8}, @code{DOUBLE PRECISION} |
462 and double real constants are not promoted. Unlike @option{-freal-4-real-8}, | |
463 @code{fdefault-real-8} does not promote variables with explicit kind | |
464 declarations. | |
408 | 465 |
409 @item -fdefault-real-10 | 466 @item -fdefault-real-10 |
410 @opindex @code{fdefault-real-10} | 467 @opindex @code{fdefault-real-10} |
411 Set the default real type to a 10 byte wide type. This option also affects | 468 Set the default real type to an 10 byte wide type. This option also affects |
412 the kind of non-double real constants like @code{1.0}, and does promote | 469 the kind of non-double real constants like @code{1.0}. This option promotes |
413 the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless | 470 the default width of @code{DOUBLE PRECISION} and double real constants |
414 @code{-fdefault-double-8} is given. Unlike @option{-freal-4-real-10}, | 471 like @code{1.d0} to 16 bytes if possible. If @code{-fdefault-double-8} |
415 it does not promote variables with explicit kind declaration. | 472 is given along with @code{fdefault-real-10}, @code{DOUBLE PRECISION} |
473 and double real constants are not promoted. Unlike @option{-freal-4-real-10}, | |
474 @code{fdefault-real-10} does not promote variables with explicit kind | |
475 declarations. | |
416 | 476 |
417 @item -fdefault-real-16 | 477 @item -fdefault-real-16 |
418 @opindex @code{fdefault-real-16} | 478 @opindex @code{fdefault-real-16} |
419 Set the default real type to a 16 byte wide type. This option also affects | 479 Set the default real type to an 16 byte wide type. This option also affects |
420 the kind of non-double real constants like @code{1.0}, and does promote | 480 the kind of non-double real constants like @code{1.0}. This option promotes |
421 the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless | 481 the default width of @code{DOUBLE PRECISION} and double real constants |
422 @code{-fdefault-double-8} is given. Unlike @option{-freal-4-real-16}, | 482 like @code{1.d0} to 16 bytes if possible. If @code{-fdefault-double-8} |
423 it does not promote variables with explicit kind declaration. | 483 is given along with @code{fdefault-real-16}, @code{DOUBLE PRECISION} |
484 and double real constants are not promoted. Unlike @option{-freal-4-real-16}, | |
485 @code{fdefault-real-16} does not promote variables with explicit kind | |
486 declarations. | |
424 | 487 |
425 @item -fdefault-double-8 | 488 @item -fdefault-double-8 |
426 @opindex @code{fdefault-double-8} | 489 @opindex @code{fdefault-double-8} |
427 Set the @code{DOUBLE PRECISION} type to an 8 byte wide type. Do nothing if this | 490 Set the @code{DOUBLE PRECISION} type and double real constants |
428 is already the default. If @option{-fdefault-real-8} is given, | 491 like @code{1.d0} to an 8 byte wide type. Do nothing if this |
429 @code{DOUBLE PRECISION} would instead be promoted to 16 bytes if possible, and | 492 is already the default. This option prevents @option{-fdefault-real-8}, |
430 @option{-fdefault-double-8} can be used to prevent this. The kind of real | 493 @option{-fdefault-real-10}, and @option{-fdefault-real-16}, |
431 constants like @code{1.d0} will not be changed by @option{-fdefault-real-8} | 494 from promoting @code{DOUBLE PRECISION} and double real constants like |
432 though, so also @option{-fdefault-double-8} does not affect it. | 495 @code{1.d0} to 16 bytes. |
433 | 496 |
434 @item -finteger-4-integer-8 | 497 @item -finteger-4-integer-8 |
435 @opindex @code{finteger-4-integer-8} | 498 @opindex @code{finteger-4-integer-8} |
436 Promote all @code{INTEGER(KIND=4)} entities to an @code{INTEGER(KIND=8)} | 499 Promote all @code{INTEGER(KIND=4)} entities to an @code{INTEGER(KIND=8)} |
437 entities. If @code{KIND=8} is unavailable, then an error will be issued. | 500 entities. If @code{KIND=8} is unavailable, then an error will be issued. |
852 @option{-std=f2018}. Note: With no ampersand given in a continued | 915 @option{-std=f2018}. Note: With no ampersand given in a continued |
853 character constant, GNU Fortran assumes continuation at the first | 916 character constant, GNU Fortran assumes continuation at the first |
854 non-comment, non-whitespace character after the ampersand that | 917 non-comment, non-whitespace character after the ampersand that |
855 initiated the continuation. | 918 initiated the continuation. |
856 | 919 |
857 @item -Wargument-mismatch | |
858 @opindex @code{Wargument-mismatch} | |
859 @cindex warnings, argument mismatch | |
860 @cindex warnings, parameter mismatch | |
861 @cindex warnings, interface mismatch | |
862 Warn about type, rank, and other mismatches between formal parameters and actual | |
863 arguments to functions and subroutines. These warnings are recommended and | |
864 thus enabled by default. | |
865 | |
866 @item -Warray-temporaries | 920 @item -Warray-temporaries |
867 @opindex @code{Warray-temporaries} | 921 @opindex @code{Warray-temporaries} |
868 @cindex warnings, array temporaries | 922 @cindex warnings, array temporaries |
869 Warn about array temporaries generated by the compiler. The information | 923 Warn about array temporaries generated by the compiler. The information |
870 generated by this warning is sometimes useful in optimization, in order to | 924 generated by this warning is sometimes useful in optimization, in order to |
916 | 970 |
917 @item -Wfrontend-loop-interchange | 971 @item -Wfrontend-loop-interchange |
918 @opindex @code{Wfrontend-loop-interchange} | 972 @opindex @code{Wfrontend-loop-interchange} |
919 @cindex warnings, loop interchange | 973 @cindex warnings, loop interchange |
920 @cindex loop interchange, warning | 974 @cindex loop interchange, warning |
921 Enable warning for loop interchanges performed by the | 975 Warn when using @option{-ffrontend-loop-interchange} for performing loop |
922 @option{-ffrontend-loop-interchange} option. | 976 interchanges. |
923 | 977 |
924 @item -Wimplicit-interface | 978 @item -Wimplicit-interface |
925 @opindex @code{Wimplicit-interface} | 979 @opindex @code{Wimplicit-interface} |
926 @cindex warnings, implicit interface | 980 @cindex warnings, implicit interface |
927 Warn if a procedure is called without an explicit interface. | 981 Warn if a procedure is called without an explicit interface. |
936 | 990 |
937 @item -Winteger-division | 991 @item -Winteger-division |
938 @opindex @code{Winteger-division} | 992 @opindex @code{Winteger-division} |
939 @cindex warnings, integer division | 993 @cindex warnings, integer division |
940 @cindex warnings, division of integers | 994 @cindex warnings, division of integers |
941 Warn if a constant integer division truncates it result. | 995 Warn if a constant integer division truncates its result. |
942 As an example, 3/5 evaluates to 0. | 996 As an example, 3/5 evaluates to 0. |
943 | 997 |
944 @item -Wintrinsics-std | 998 @item -Wintrinsics-std |
945 @opindex @code{Wintrinsics-std} | 999 @opindex @code{Wintrinsics-std} |
946 @cindex warnings, non-standard intrinsics | 1000 @cindex warnings, non-standard intrinsics |
948 Warn if @command{gfortran} finds a procedure named like an intrinsic not | 1002 Warn if @command{gfortran} finds a procedure named like an intrinsic not |
949 available in the currently selected standard (with @option{-std}) and treats | 1003 available in the currently selected standard (with @option{-std}) and treats |
950 it as @code{EXTERNAL} procedure because of this. @option{-fall-intrinsics} can | 1004 it as @code{EXTERNAL} procedure because of this. @option{-fall-intrinsics} can |
951 be used to never trigger this behavior and always link to the intrinsic | 1005 be used to never trigger this behavior and always link to the intrinsic |
952 regardless of the selected standard. | 1006 regardless of the selected standard. |
1007 | |
1008 @item -Wno-overwrite-recursive | |
1009 @opindex @code{Woverwrite-recursive} | |
1010 @cindex warnings, overwrite recursive | |
1011 Do not warn when @option{-fno-automatic} is used with @option{-frecursive}. Recursion | |
1012 will be broken if the relevant local variables do not have the attribute | |
1013 @code{AUTOMATIC} explicitly declared. This option can be used to suppress the warning | |
1014 when it is known that recursion is not broken. Useful for build environments that use | |
1015 @option{-Werror}. | |
953 | 1016 |
954 @item -Wreal-q-constant | 1017 @item -Wreal-q-constant |
955 @opindex @code{Wreal-q-constant} | 1018 @opindex @code{Wreal-q-constant} |
956 @cindex warnings, @code{q} exponent-letter | 1019 @cindex warnings, @code{q} exponent-letter |
957 Produce a warning if a real-literal-constant contains a @code{q} | 1020 Produce a warning if a real-literal-constant contains a @code{q} |
1094 time. This option is implied by @option{-Wall}. | 1157 time. This option is implied by @option{-Wall}. |
1095 | 1158 |
1096 @item -Wdo-subscript | 1159 @item -Wdo-subscript |
1097 @opindex @code{Wdo-subscript} | 1160 @opindex @code{Wdo-subscript} |
1098 Warn if an array subscript inside a DO loop could lead to an | 1161 Warn if an array subscript inside a DO loop could lead to an |
1099 out-of-bounds access even if the compiler can not prove that the | 1162 out-of-bounds access even if the compiler cannot prove that the |
1100 statement is actually executed, in cases like | 1163 statement is actually executed, in cases like |
1101 @smallexample | 1164 @smallexample |
1102 real a(3) | 1165 real a(3) |
1103 do i=1,4 | 1166 do i=1,4 |
1104 if (condition(i)) then | 1167 if (condition(i)) then |
1153 into internal representation. Mostly useful for debugging the GNU | 1216 into internal representation. Mostly useful for debugging the GNU |
1154 Fortran compiler itself. The output generated by this option might | 1217 Fortran compiler itself. The output generated by this option might |
1155 change between releases. This option may also generate internal | 1218 change between releases. This option may also generate internal |
1156 compiler errors for features which have only recently been added. This | 1219 compiler errors for features which have only recently been added. This |
1157 option is deprecated; use @code{-fdump-fortran-original} instead. | 1220 option is deprecated; use @code{-fdump-fortran-original} instead. |
1221 | |
1222 @item -fdump-fortran-global | |
1223 @opindex @code{fdump-fortran-global} | |
1224 Output a list of the global identifiers after translating into | |
1225 middle-end representation. Mostly useful for debugging the GNU Fortran | |
1226 compiler itself. The output generated by this option might change | |
1227 between releases. This option may also generate internal compiler | |
1228 errors for features which have only recently been added. | |
1158 | 1229 |
1159 @item -ffpe-trap=@var{list} | 1230 @item -ffpe-trap=@var{list} |
1160 @opindex @code{ffpe-trap=}@var{list} | 1231 @opindex @code{ffpe-trap=}@var{list} |
1161 Specify a list of floating point exception traps to enable. On most | 1232 Specify a list of floating point exception traps to enable. On most |
1162 systems, if a floating point exception occurs and the trap for that | 1233 systems, if a floating point exception occurs and the trap for that |
1176 The first three exceptions (@samp{invalid}, @samp{zero}, and | 1247 The first three exceptions (@samp{invalid}, @samp{zero}, and |
1177 @samp{overflow}) often indicate serious errors, and unless the program | 1248 @samp{overflow}) often indicate serious errors, and unless the program |
1178 has provisions for dealing with these exceptions, enabling traps for | 1249 has provisions for dealing with these exceptions, enabling traps for |
1179 these three exceptions is probably a good idea. | 1250 these three exceptions is probably a good idea. |
1180 | 1251 |
1252 If the option is used more than once in the command line, the lists will | |
1253 be joined: '@code{ffpe-trap=}@var{list1} @code{ffpe-trap=}@var{list2}' | |
1254 is equivalent to @code{ffpe-trap=}@var{list1},@var{list2}. | |
1255 | |
1256 Note that once enabled an exception cannot be disabled (no negative form). | |
1257 | |
1181 Many, if not most, floating point operations incur loss of precision | 1258 Many, if not most, floating point operations incur loss of precision |
1182 due to rounding, and hence the @code{ffpe-trap=inexact} is likely to | 1259 due to rounding, and hence the @code{ffpe-trap=inexact} is likely to |
1183 be uninteresting in practice. | 1260 be uninteresting in practice. |
1184 | 1261 |
1185 By default no exception traps are enabled. | 1262 By default no exception traps are enabled. |
1190 to @code{ERROR_UNIT} when invoking @code{STOP} and @code{ERROR STOP}. | 1267 to @code{ERROR_UNIT} when invoking @code{STOP} and @code{ERROR STOP}. |
1191 @var{list} can be either @samp{none}, @samp{all} or a comma-separated list | 1268 @var{list} can be either @samp{none}, @samp{all} or a comma-separated list |
1192 of the following exceptions: @samp{invalid}, @samp{zero}, @samp{overflow}, | 1269 of the following exceptions: @samp{invalid}, @samp{zero}, @samp{overflow}, |
1193 @samp{underflow}, @samp{inexact} and @samp{denormal}. (See | 1270 @samp{underflow}, @samp{inexact} and @samp{denormal}. (See |
1194 @option{-ffpe-trap} for a description of the exceptions.) | 1271 @option{-ffpe-trap} for a description of the exceptions.) |
1272 | |
1273 If the option is used more than once in the command line, only the | |
1274 last one will be used. | |
1195 | 1275 |
1196 By default, a summary for all exceptions but @samp{inexact} is shown. | 1276 By default, a summary for all exceptions but @samp{inexact} is shown. |
1197 | 1277 |
1198 @item -fno-backtrace | 1278 @item -fno-backtrace |
1199 @opindex @code{fno-backtrace} | 1279 @opindex @code{fno-backtrace} |
1358 referenced in it. Does not affect common blocks. (Some Fortran compilers | 1438 referenced in it. Does not affect common blocks. (Some Fortran compilers |
1359 provide this option under the name @option{-static} or @option{-save}.) | 1439 provide this option under the name @option{-static} or @option{-save}.) |
1360 The default, which is @option{-fautomatic}, uses the stack for local | 1440 The default, which is @option{-fautomatic}, uses the stack for local |
1361 variables smaller than the value given by @option{-fmax-stack-var-size}. | 1441 variables smaller than the value given by @option{-fmax-stack-var-size}. |
1362 Use the option @option{-frecursive} to use no static memory. | 1442 Use the option @option{-frecursive} to use no static memory. |
1443 | |
1444 Local variables or arrays having an explicit @code{SAVE} attribute are | |
1445 silently ignored unless the @option{-pedantic} option is added. | |
1363 | 1446 |
1364 @item -ff2c | 1447 @item -ff2c |
1365 @opindex ff2c | 1448 @opindex ff2c |
1366 @cindex calling convention | 1449 @cindex calling convention |
1367 @cindex @command{f2c} calling convention | 1450 @cindex @command{f2c} calling convention |
1508 | 1591 |
1509 | 1592 |
1510 @item -fcheck=@var{<keyword>} | 1593 @item -fcheck=@var{<keyword>} |
1511 @opindex @code{fcheck} | 1594 @opindex @code{fcheck} |
1512 @cindex array, bounds checking | 1595 @cindex array, bounds checking |
1596 @cindex bit intrinsics checking | |
1513 @cindex bounds checking | 1597 @cindex bounds checking |
1514 @cindex pointer checking | 1598 @cindex pointer checking |
1515 @cindex memory checking | 1599 @cindex memory checking |
1516 @cindex range checking | 1600 @cindex range checking |
1517 @cindex subscript checking | 1601 @cindex subscript checking |
1532 had to be generated. The information generated by this warning is | 1616 had to be generated. The information generated by this warning is |
1533 sometimes useful in optimization, in order to avoid such temporaries. | 1617 sometimes useful in optimization, in order to avoid such temporaries. |
1534 | 1618 |
1535 Note: The warning is only printed once per location. | 1619 Note: The warning is only printed once per location. |
1536 | 1620 |
1621 @item @samp{bits} | |
1622 Enable generation of run-time checks for invalid arguments to the bit | |
1623 manipulation intrinsics. | |
1624 | |
1537 @item @samp{bounds} | 1625 @item @samp{bounds} |
1538 Enable generation of run-time checks for array subscripts | 1626 Enable generation of run-time checks for array subscripts |
1539 and against the declared minimum and maximum values. It also | 1627 and against the declared minimum and maximum values. It also |
1540 checks array indices for assumed and deferred | 1628 checks array indices for assumed and deferred |
1541 shape arrays against the actual allocated bounds and ensures that all string | 1629 shape arrays against the actual allocated bounds and ensures that all string |
1577 | 1665 |
1578 @item -fbounds-check | 1666 @item -fbounds-check |
1579 @opindex @code{fbounds-check} | 1667 @opindex @code{fbounds-check} |
1580 @c Note: This option is also referred in gcc's manpage | 1668 @c Note: This option is also referred in gcc's manpage |
1581 Deprecated alias for @option{-fcheck=bounds}. | 1669 Deprecated alias for @option{-fcheck=bounds}. |
1670 | |
1671 @item -ftail-call-workaround | |
1672 @itemx -ftail-call-workaround=@var{n} | |
1673 @opindex @code{tail-call-workaround} | |
1674 Some C interfaces to Fortran codes violate the gfortran ABI by | |
1675 omitting the hidden character length arguments as described in | |
1676 @xref{Argument passing conventions}. This can lead to crashes | |
1677 because pushing arguments for tail calls can overflow the stack. | |
1678 | |
1679 To provide a workaround for existing binary packages, this option | |
1680 disables tail call optimization for gfortran procedures with character | |
1681 arguments. With @option{-ftail-call-workaround=2} tail call optimization | |
1682 is disabled in all gfortran procedures with character arguments, | |
1683 with @option{-ftail-call-workaround=1} or equivalent | |
1684 @option{-ftail-call-workaround} only in gfortran procedures with character | |
1685 arguments that call implicitly prototyped procedures. | |
1686 | |
1687 Using this option can lead to problems including crashes due to | |
1688 insufficient stack space. | |
1689 | |
1690 It is @emph{very strongly} recommended to fix the code in question. | |
1691 The @option{-fc-prototypes-external} option can be used to generate | |
1692 prototypes which conform to gfortran's ABI, for inclusion in the | |
1693 source code. | |
1694 | |
1695 Support for this option will likely be withdrawn in a future release | |
1696 of gfortran. | |
1697 | |
1698 The negative form, @option{-fno-tail-call-workaround} or equivalent | |
1699 @option{-ftail-call-workaround=0}, can be used to disable this option. | |
1700 | |
1701 Default is currently @option{-ftail-call-workaround}, this will change | |
1702 in future releases. | |
1582 | 1703 |
1583 @item -fcheck-array-temporaries | 1704 @item -fcheck-array-temporaries |
1584 @opindex @code{fcheck-array-temporaries} | 1705 @opindex @code{fcheck-array-temporaries} |
1585 Deprecated alias for @option{-fcheck=array-temps}. | 1706 Deprecated alias for @option{-fcheck=array-temps}. |
1586 | 1707 |
1616 | 1737 |
1617 This option currently only affects local arrays declared with constant | 1738 This option currently only affects local arrays declared with constant |
1618 bounds, and may not apply to all character variables. | 1739 bounds, and may not apply to all character variables. |
1619 Future versions of GNU Fortran may improve this behavior. | 1740 Future versions of GNU Fortran may improve this behavior. |
1620 | 1741 |
1621 The default value for @var{n} is 32768. | 1742 The default value for @var{n} is 65536. |
1622 | 1743 |
1623 @item -fstack-arrays | 1744 @item -fstack-arrays |
1624 @opindex @code{fstack-arrays} | 1745 @opindex @code{fstack-arrays} |
1625 Adding this option will make the Fortran compiler put all arrays of | 1746 Adding this option will make the Fortran compiler put all arrays of |
1626 unknown size and array temporaries onto stack memory. If your program uses very | 1747 unknown size and array temporaries onto stack memory. If your program uses very |
1652 @opindex @code{fshort-enums} | 1773 @opindex @code{fshort-enums} |
1653 This option is provided for interoperability with C code that was | 1774 This option is provided for interoperability with C code that was |
1654 compiled with the @option{-fshort-enums} option. It will make | 1775 compiled with the @option{-fshort-enums} option. It will make |
1655 GNU Fortran choose the smallest @code{INTEGER} kind a given | 1776 GNU Fortran choose the smallest @code{INTEGER} kind a given |
1656 enumerator set will fit in, and give all its enumerators this kind. | 1777 enumerator set will fit in, and give all its enumerators this kind. |
1778 | |
1779 @item -finline-arg-packing | |
1780 @opindex @code{finline-arg-packing} | |
1781 When passing an assumed-shape argument of a procedure as actual | |
1782 argument to an assumed-size or explicit size or as argument to a | |
1783 procedure that does not have an explicit interface, the argument may | |
1784 have to be packed, that is put into contiguous memory. An example is | |
1785 the call to @code{foo} in | |
1786 @smallexample | |
1787 subroutine foo(a) | |
1788 real, dimension(*) :: a | |
1789 end subroutine foo | |
1790 subroutine bar(b) | |
1791 real, dimension(:) :: b | |
1792 call foo(b) | |
1793 end subroutine bar | |
1794 @end smallexample | |
1795 | |
1796 When @option{-finline-arg-packing} is in effect, this packing will be | |
1797 performed by inline code. This allows for more optimization while | |
1798 increasing code size. | |
1799 | |
1800 @option{-finline-arg-packing} is implied by any of the @option{-O} options | |
1801 except when optimizing for size via @option{-Os}. If the code | |
1802 contains a very large number of argument that have to be packed, code | |
1803 size and also compilation time may become excessive. If that is the | |
1804 case, it may be better to disable this option. Instances of packing | |
1805 can be found by using by using @option{-Warray-temporaries}. | |
1657 | 1806 |
1658 @item -fexternal-blas | 1807 @item -fexternal-blas |
1659 @opindex @code{fexternal-blas} | 1808 @opindex @code{fexternal-blas} |
1660 This option will make @command{gfortran} generate calls to BLAS functions | 1809 This option will make @command{gfortran} generate calls to BLAS functions |
1661 for some matrix operations like @code{MATMUL}, instead of using our own | 1810 for some matrix operations like @code{MATMUL}, instead of using our own |
1740 and @code{COMPLEX} variables with a quiet NaN. For a signalling NaN | 1889 and @code{COMPLEX} variables with a quiet NaN. For a signalling NaN |
1741 use @option{-finit-real=snan}; note, however, that compile-time | 1890 use @option{-finit-real=snan}; note, however, that compile-time |
1742 optimizations may convert them into quiet NaN and that trapping | 1891 optimizations may convert them into quiet NaN and that trapping |
1743 needs to be enabled (e.g. via @option{-ffpe-trap}). | 1892 needs to be enabled (e.g. via @option{-ffpe-trap}). |
1744 | 1893 |
1894 The @option{-finit-integer} option will parse the value into an | |
1895 integer of type @code{INTEGER(kind=C_LONG)} on the host. Said value | |
1896 is then assigned to the integer variables in the Fortran code, which | |
1897 might result in wraparound if the value is too large for the kind. | |
1898 | |
1745 Finally, note that enabling any of the @option{-finit-*} options will | 1899 Finally, note that enabling any of the @option{-finit-*} options will |
1746 silence warnings that would have been emitted by @option{-Wuninitialized} | 1900 silence warnings that would have been emitted by @option{-Wuninitialized} |
1747 for the affected local variables. | 1901 for the affected local variables. |
1748 | 1902 |
1749 @item -falign-commons | 1903 @item -falign-commons |
1826 | 1980 |
1827 @table @asis | 1981 @table @asis |
1828 | 1982 |
1829 @item -fc-prototypes | 1983 @item -fc-prototypes |
1830 @opindex @code{c-prototypes} | 1984 @opindex @code{c-prototypes} |
1831 @cindex Generating C prototypes from Fortran source code | 1985 @cindex Generating C prototypes from Fortran BIND(C) enteties |
1832 This option will generate C prototypes from @code{BIND(C)} variable | 1986 This option will generate C prototypes from @code{BIND(C)} variable |
1833 declarations, types and procedure interfaces and writes them to | 1987 declarations, types and procedure interfaces and writes them to |
1834 standard output. @code{ENUM} is not yet supported. | 1988 standard output. @code{ENUM} is not yet supported. |
1835 | 1989 |
1836 The generated prototypes may need inclusion of an appropriate header, | 1990 The generated prototypes may need inclusion of an appropriate header, |
1845 @smallexample | 1999 @smallexample |
1846 $ gfortran -fc-prototypes -fsyntax-only foo.f90 > foo.h | 2000 $ gfortran -fc-prototypes -fsyntax-only foo.f90 > foo.h |
1847 @end smallexample | 2001 @end smallexample |
1848 where the C code intended for interoperating with the Fortran code | 2002 where the C code intended for interoperating with the Fortran code |
1849 then uses @code{#include "foo.h"}. | 2003 then uses @code{#include "foo.h"}. |
2004 | |
2005 @item -fc-prototypes-external | |
2006 @opindex @code{c-prototypes-external} | |
2007 @cindex Generating C prototypes from external procedures | |
2008 This option will generate C prototypes from external functions and | |
2009 subroutines and write them to standard output. This may be useful for | |
2010 making sure that C bindings to Fortran code are correct. This option | |
2011 does not generate prototypes for @code{BIND(C)} procedures, use | |
2012 @option{-fc-prototypes} for that. | |
2013 | |
2014 The generated prototypes may need inclusion of an appropriate | |
2015 header, such as as @code{<stdint.h>} or @code{<stdlib.h>}. | |
2016 | |
2017 This is primarily meant for legacy code to ensure that existing C | |
2018 bindings match what @command{gfortran} emits. The generated C | |
2019 prototypes should be correct for the current version of the compiler, | |
2020 but may not match what other compilers or earlier versions of | |
2021 @command{gfortran} need. For new developments, use of the | |
2022 @code{BIND(C)} features is recommended. | |
2023 | |
2024 Example of use: | |
2025 @smallexample | |
2026 $ gfortran -fc-prototypes-external -fsyntax-only foo.f > foo.h | |
2027 @end smallexample | |
2028 where the C code intended for interoperating with the Fortran code | |
2029 then uses @code{#include "foo.h"}. | |
1850 @end table | 2030 @end table |
1851 | 2031 |
1852 @node Environment Variables | 2032 @node Environment Variables |
1853 @section Environment variables affecting @command{gfortran} | 2033 @section Environment variables affecting @command{gfortran} |
1854 @cindex environment variable | 2034 @cindex environment variable |