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