]>
Commit | Line | Data |
---|---|---|
8e5578ea | 1 | @c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 |
2 | @c Free Software Foundation, Inc. | |
3 | @c This is part of the G77 manual. | |
4 | @c For copying conditions, see the file g77.texi. | |
5 | ||
6 | @ignore | |
7 | @c man begin COPYRIGHT | |
8 | Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 | |
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 g77 | |
31 | @settitle GNU project Fortran 77 compiler. | |
32 | @c man begin SYNOPSIS | |
33 | g77 [@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{}] [@option{-m}@var{machine-option}@dots{}] | |
39 | [@option{-o} @var{outfile}] @var{infile}@dots{} | |
40 | ||
41 | Only the most useful options are listed here; see below for the | |
42 | remainder. | |
43 | @c man end | |
44 | @c man begin SEEALSO | |
45 | gpl(7), gfdl(7), fsf-funding(7), | |
46 | cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) | |
47 | and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as}, | |
48 | @file{ld}, @file{binutils} and @file{gdb}. | |
49 | @c man end | |
50 | @c man begin BUGS | |
51 | For instructions on reporting bugs, see | |
52 | @w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug} | |
53 | script to report bugs is recommended. | |
54 | @c man end | |
55 | @c man begin AUTHOR | |
56 | See the Info entry for @command{g77} for contributors to GCC and G77@. | |
57 | @c man end | |
58 | @end ignore | |
59 | ||
60 | @node Invoking G77 | |
61 | @chapter GNU Fortran Command Options | |
62 | @cindex GNU Fortran command options | |
63 | @cindex command options | |
64 | @cindex options, GNU Fortran command | |
65 | ||
66 | @c man begin DESCRIPTION | |
67 | ||
68 | The @command{g77} command supports all the options supported by the | |
69 | @command{gcc} command. | |
70 | @xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler | |
71 | Collection (GCC)}, for information | |
72 | on the non-Fortran-specific aspects of the @command{gcc} command (and, | |
73 | therefore, the @command{g77} command). | |
74 | ||
75 | @cindex options, negative forms | |
76 | @cindex negative forms of options | |
77 | All @command{gcc} and @command{g77} options | |
78 | are accepted both by @command{g77} and by @command{gcc} | |
79 | (as well as any other drivers built at the same time, | |
80 | such as @command{g++}), | |
81 | since adding @command{g77} to the @command{gcc} distribution | |
82 | enables acceptance of @command{g77} options | |
83 | by all of the relevant drivers. | |
84 | ||
85 | In some cases, options have positive and negative forms; | |
86 | the negative form of @option{-ffoo} would be @option{-fno-foo}. | |
87 | This manual documents only one of these two forms, whichever | |
88 | one is not the default. | |
89 | ||
90 | @c man end | |
91 | ||
92 | @menu | |
93 | * Option Summary:: Brief list of all @command{g77} options, | |
94 | without explanations. | |
95 | * Overall Options:: Controlling the kind of output: | |
96 | an executable, object files, assembler files, | |
97 | or preprocessed source. | |
98 | * Shorthand Options:: Options that are shorthand for other options. | |
99 | * Fortran Dialect Options:: Controlling the variant of Fortran language | |
100 | compiled. | |
101 | * Warning Options:: How picky should the compiler be? | |
102 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
103 | * Optimize Options:: How much optimization? | |
104 | * Preprocessor Options:: Controlling header files and macro definitions. | |
105 | Also, getting dependency information for Make. | |
106 | * Directory Options:: Where to find header files and libraries. | |
107 | Where to find the compiler executable files. | |
108 | * Code Gen Options:: Specifying conventions for function calls, data layout | |
109 | and register usage. | |
110 | * Environment Variables:: Env vars that affect GNU Fortran. | |
111 | @end menu | |
112 | ||
113 | @node Option Summary | |
114 | @section Option Summary | |
115 | ||
116 | @c man begin OPTIONS | |
117 | ||
118 | Here is a summary of all the options specific to GNU Fortran, grouped | |
119 | by type. Explanations are in the following sections. | |
120 | ||
121 | @table @emph | |
122 | @item Overall Options | |
123 | @xref{Overall Options,,Options Controlling the Kind of Output}. | |
124 | @gccoptlist{ | |
125 | -fversion -fset-g77-defaults -fno-silent} | |
126 | ||
127 | @item Shorthand Options | |
128 | @xref{Shorthand Options}. | |
129 | @gccoptlist{ | |
130 | -ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly} | |
131 | ||
132 | @item Fortran Language Options | |
133 | @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}. | |
134 | @gccoptlist{ | |
135 | -ffree-form -fno-fixed-form -ff90 @gol | |
136 | -fvxt -fdollar-ok -fno-backslash @gol | |
137 | -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed @gol | |
138 | -fugly-comma -fugly-complex -fugly-init -fugly-logint @gol | |
139 | -fonetrip -ftypeless-boz @gol | |
140 | -fintrin-case-initcap -fintrin-case-upper @gol | |
141 | -fintrin-case-lower -fintrin-case-any @gol | |
142 | -fmatch-case-initcap -fmatch-case-upper @gol | |
143 | -fmatch-case-lower -fmatch-case-any @gol | |
144 | -fsource-case-upper -fsource-case-lower @gol | |
145 | -fsource-case-preserve @gol | |
146 | -fsymbol-case-initcap -fsymbol-case-upper @gol | |
147 | -fsymbol-case-lower -fsymbol-case-any @gol | |
148 | -fcase-strict-upper -fcase-strict-lower @gol | |
149 | -fcase-initcap -fcase-upper -fcase-lower -fcase-preserve @gol | |
150 | -ff2c-intrinsics-delete -ff2c-intrinsics-hide @gol | |
151 | -ff2c-intrinsics-disable -ff2c-intrinsics-enable @gol | |
152 | -fbadu77-intrinsics-delete -fbadu77-intrinsics-hide @gol | |
153 | -fbadu77-intrinsics-disable -fbadu77-intrinsics-enable @gol | |
154 | -ff90-intrinsics-delete -ff90-intrinsics-hide @gol | |
155 | -ff90-intrinsics-disable -ff90-intrinsics-enable @gol | |
156 | -fgnu-intrinsics-delete -fgnu-intrinsics-hide @gol | |
157 | -fgnu-intrinsics-disable -fgnu-intrinsics-enable @gol | |
158 | -fmil-intrinsics-delete -fmil-intrinsics-hide @gol | |
159 | -fmil-intrinsics-disable -fmil-intrinsics-enable @gol | |
160 | -funix-intrinsics-delete -funix-intrinsics-hide @gol | |
161 | -funix-intrinsics-disable -funix-intrinsics-enable @gol | |
162 | -fvxt-intrinsics-delete -fvxt-intrinsics-hide @gol | |
163 | -fvxt-intrinsics-disable -fvxt-intrinsics-enable @gol | |
164 | -ffixed-line-length-@var{n} -ffixed-line-length-none} | |
165 | ||
166 | @item Warning Options | |
167 | @xref{Warning Options,,Options to Request or Suppress Warnings}. | |
168 | @gccoptlist{ | |
169 | -fsyntax-only -pedantic -pedantic-errors -fpedantic @gol | |
170 | -w -Wno-globals -Wimplicit -Wunused -Wuninitialized @gol | |
171 | -Wall -Wsurprising @gol | |
172 | -Werror -W} | |
173 | ||
174 | @item Debugging Options | |
175 | @xref{Debugging Options,,Options for Debugging Your Program or GCC}. | |
176 | @gccoptlist{ | |
177 | -g} | |
178 | ||
179 | @item Optimization Options | |
180 | @xref{Optimize Options,,Options that Control Optimization}. | |
181 | @gccoptlist{ | |
182 | -malign-double @gol | |
183 | -ffloat-store -fforce-mem -fforce-addr -fno-inline @gol | |
184 | -ffast-math -fstrength-reduce -frerun-cse-after-loop @gol | |
185 | -funsafe-math-optimizations -ffinite-math-only -fno-trapping-math @gol | |
186 | -fexpensive-optimizations -fdelayed-branch @gol | |
187 | -fschedule-insns -fschedule-insn2 -fcaller-saves @gol | |
188 | -funroll-loops -funroll-all-loops @gol | |
189 | -fno-move-all-movables -fno-reduce-all-givs @gol | |
190 | -fno-rerun-loop-opt} | |
191 | ||
192 | @item Directory Options | |
193 | @xref{Directory Options,,Options for Directory Search}. | |
194 | @gccoptlist{ | |
195 | -I@var{dir} -I-} | |
196 | ||
197 | @item Code Generation Options | |
198 | @xref{Code Gen Options,,Options for Code Generation Conventions}. | |
199 | @gccoptlist{ | |
200 | -fno-automatic -finit-local-zero -fno-f2c @gol | |
201 | -ff2c-library -fno-underscoring -fno-ident @gol | |
202 | -fpcc-struct-return -freg-struct-return @gol | |
203 | -fshort-double -fno-common -fpack-struct @gol | |
204 | -fzeros -fno-second-underscore @gol | |
205 | -femulate-complex @gol | |
206 | -falias-check -fargument-alias @gol | |
207 | -fargument-noalias -fno-argument-noalias-global @gol | |
208 | -fno-globals -fflatten-arrays @gol | |
209 | -fbounds-check -ffortran-bounds-check} | |
210 | @end table | |
211 | ||
212 | @c man end | |
213 | ||
214 | @menu | |
215 | * Overall Options:: Controlling the kind of output: | |
216 | an executable, object files, assembler files, | |
217 | or preprocessed source. | |
218 | * Shorthand Options:: Options that are shorthand for other options. | |
219 | * Fortran Dialect Options:: Controlling the variant of Fortran language | |
220 | compiled. | |
221 | * Warning Options:: How picky should the compiler be? | |
222 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. | |
223 | * Optimize Options:: How much optimization? | |
224 | * Preprocessor Options:: Controlling header files and macro definitions. | |
225 | Also, getting dependency information for Make. | |
226 | * Directory Options:: Where to find header files and libraries. | |
227 | Where to find the compiler executable files. | |
228 | * Code Gen Options:: Specifying conventions for function calls, data layout | |
229 | and register usage. | |
230 | @end menu | |
231 | ||
232 | @node Overall Options | |
233 | @section Options Controlling the Kind of Output | |
234 | @cindex overall options | |
235 | @cindex options, overall | |
236 | ||
237 | @c man begin OPTIONS | |
238 | ||
239 | Compilation can involve as many as four stages: preprocessing, code | |
240 | generation (often what is really meant by the term ``compilation''), | |
241 | assembly, and linking, always in that order. The first three | |
242 | stages apply to an individual source file, and end by producing an | |
243 | object file; linking combines all the object files (those newly | |
244 | compiled, and those specified as input) into an executable file. | |
245 | ||
246 | @cindex file name suffix | |
247 | @cindex suffixes, file name | |
248 | @cindex file name extension | |
249 | @cindex extensions, file name | |
250 | @cindex file type | |
251 | @cindex types, file | |
252 | For any given input file, the file name suffix determines what kind of | |
253 | program is contained in the file---that is, the language in which the | |
254 | program is written is generally indicated by the suffix. | |
255 | Suffixes specific to GNU Fortran are listed below. | |
256 | @xref{Overall Options,,Options Controlling the Kind of | |
257 | Output,gcc,Using the GNU Compiler Collection (GCC)}, for | |
258 | information on suffixes recognized by GCC. | |
259 | ||
260 | @table @gcctabopt | |
261 | @cindex .f filename suffix | |
262 | @cindex .for filename suffix | |
263 | @cindex .FOR filename suffix | |
264 | @item @var{file}.f | |
265 | @item @var{file}.for | |
266 | @item @var{file}.FOR | |
267 | Fortran source code that should not be preprocessed. | |
268 | ||
269 | Such source code cannot contain any preprocessor directives, such | |
270 | as @code{#include}, @code{#define}, @code{#if}, and so on. | |
271 | ||
272 | You can force @samp{.f} files to be preprocessed by @command{cpp} by using | |
273 | @option{-x f77-cpp-input}. | |
274 | @xref{LEX}. | |
275 | ||
276 | @cindex preprocessor | |
277 | @cindex C preprocessor | |
278 | @cindex cpp preprocessor | |
279 | @cindex Fortran preprocessor | |
280 | @cindex cpp program | |
281 | @cindex programs, cpp | |
282 | @cindex .F filename suffix | |
283 | @cindex .fpp filename suffix | |
284 | @cindex .FPP filename suffix | |
285 | @item @var{file}.F | |
286 | @item @var{file}.fpp | |
287 | @item @var{file}.FPP | |
288 | Fortran source code that must be preprocessed (by the C preprocessor | |
289 | @command{cpp}, which is part of GCC). | |
290 | ||
291 | Note that preprocessing is not extended to the contents of | |
292 | files included by the @code{INCLUDE} directive---the @code{#include} | |
293 | preprocessor directive must be used instead. | |
294 | ||
295 | @cindex Ratfor preprocessor | |
296 | @cindex programs, @command{ratfor} | |
297 | @cindex @samp{.r} filename suffix | |
298 | @cindex @command{ratfor} | |
299 | @item @var{file}.r | |
300 | Ratfor source code, which must be preprocessed by the @command{ratfor} | |
301 | command, which is available separately (as it is not yet part of the GNU | |
302 | Fortran distribution). | |
303 | A public domain version in C is at | |
304 | @uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}. | |
305 | @end table | |
306 | ||
307 | UNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F} | |
308 | nomenclature. | |
309 | Users of other operating systems, especially those that cannot | |
310 | distinguish upper-case | |
311 | letters from lower-case letters in their file names, typically use | |
312 | the @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature. | |
313 | ||
314 | @cindex #define | |
315 | @cindex #include | |
316 | @cindex #if | |
317 | Use of the preprocessor @command{cpp} allows use of C-like | |
318 | constructs such as @code{#define} and @code{#include}, but can | |
319 | lead to unexpected, even mistaken, results due to Fortran's source file | |
320 | format. | |
321 | It is recommended that use of the C preprocessor | |
322 | be limited to @code{#include} and, in | |
323 | conjunction with @code{#define}, only @code{#if} and related directives, | |
324 | thus avoiding in-line macro expansion entirely. | |
325 | This recommendation applies especially | |
326 | when using the traditional fixed source form. | |
327 | With free source form, | |
328 | fewer unexpected transformations are likely to happen, but use of | |
329 | constructs such as Hollerith and character constants can nevertheless | |
330 | present problems, especially when these are continued across multiple | |
331 | source lines. | |
332 | These problems result, primarily, from differences between the way | |
333 | such constants are interpreted by the C preprocessor and by a Fortran | |
334 | compiler. | |
335 | ||
336 | Another example of a problem that results from using the C preprocessor | |
337 | is that a Fortran comment line that happens to contain any | |
338 | characters ``interesting'' to the C preprocessor, | |
339 | such as a backslash at the end of the line, | |
340 | is not recognized by the preprocessor as a comment line, | |
341 | so instead of being passed through ``raw'', | |
342 | the line is edited according to the rules for the preprocessor. | |
343 | For example, the backslash at the end of the line is removed, | |
344 | along with the subsequent newline, resulting in the next | |
345 | line being effectively commented out---unfortunate if that | |
346 | line is a non-comment line of important code! | |
347 | ||
348 | @emph{Note:} The @option{-traditional} and @option{-undef} flags are supplied | |
349 | to @command{cpp} by default, to help avoid unpleasant surprises. | |
350 | @xref{Preprocessor Options,,Options Controlling the Preprocessor, | |
351 | gcc,Using the GNU Compiler Collection (GCC)}. | |
352 | This means that ANSI C preprocessor features (such as the @samp{#} | |
353 | operator) aren't available, and only variables in the C reserved | |
354 | namespace (generally, names with a leading underscore) are liable to | |
355 | substitution by C predefines. | |
356 | Thus, if you want to do system-specific | |
357 | tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}. | |
358 | Use the @option{-v} option to see exactly how the preprocessor is invoked. | |
359 | ||
360 | @cindex /* | |
361 | Unfortunately, the @option{-traditional} flag will not avoid an error from | |
362 | anything that @command{cpp} sees as an unterminated C comment, such as: | |
363 | @smallexample | |
364 | C Some Fortran compilers accept /* as starting | |
365 | C an inline comment. | |
366 | @end smallexample | |
367 | @xref{Trailing Comment}. | |
368 | ||
369 | The following options that affect overall processing are recognized | |
370 | by the @command{g77} and @command{gcc} commands in a GNU Fortran installation: | |
371 | ||
372 | @table @gcctabopt | |
373 | @cindex -fversion option | |
374 | @cindex options, -fversion | |
375 | @cindex printing version information | |
376 | @cindex version information, printing | |
377 | @cindex consistency checks | |
378 | @cindex internal consistency checks | |
379 | @cindex checks, of internal consistency | |
380 | @item -fversion | |
381 | Ensure that the @command{g77} version of the compiler phase is reported, | |
382 | if run, | |
383 | and, starting in @code{egcs} version 1.1, | |
384 | that internal consistency checks in the @file{f771} program are run. | |
385 | ||
386 | This option is supplied automatically when @option{-v} or @option{--verbose} | |
387 | is specified as a command-line option for @command{g77} or @command{gcc} | |
388 | and when the resulting commands compile Fortran source files. | |
389 | ||
390 | In GCC 3.1, this is changed back to the behavior @command{gcc} displays | |
391 | for @samp{.c} files. | |
392 | ||
393 | @cindex -fset-g77-defaults option | |
394 | @cindex options, -fset-g77-defaults | |
395 | @item -fset-g77-defaults | |
396 | @emph{Version info:} | |
397 | This option was obsolete as of @code{egcs} | |
398 | version 1.1. | |
399 | The effect is instead achieved | |
400 | by the @code{lang_init_options} routine | |
401 | in @file{gcc/gcc/f/com.c}. | |
402 | ||
403 | @cindex consistency checks | |
404 | @cindex internal consistency checks | |
405 | @cindex checks, of internal consistency | |
406 | Set up whatever @command{gcc} options are to apply to Fortran | |
407 | compilations, and avoid running internal consistency checks | |
408 | that might take some time. | |
409 | ||
410 | This option is supplied automatically when compiling Fortran code | |
411 | via the @command{g77} or @command{gcc} command. | |
412 | The description of this option is provided so that users seeing | |
413 | it in the output of, say, @samp{g77 -v} understand why it is | |
414 | there. | |
415 | ||
416 | @cindex modifying @command{g77} | |
417 | @cindex @command{g77}, modifying | |
418 | Also, developers who run @code{f771} directly might want to specify it | |
419 | by hand to get the same defaults as they would running @code{f771} | |
420 | via @command{g77} or @command{gcc} | |
421 | However, such developers should, after linking a new @code{f771} | |
422 | executable, invoke it without this option once, | |
423 | e.g. via @kbd{./f771 -quiet < /dev/null}, | |
424 | to ensure that they have not introduced any | |
425 | internal inconsistencies (such as in the table of | |
426 | intrinsics) before proceeding---@command{g77} will crash | |
427 | with a diagnostic if it detects an inconsistency. | |
428 | ||
429 | @cindex -fno-silent option | |
430 | @cindex options, -fno-silent | |
431 | @cindex f2c compatibility | |
432 | @cindex compatibility, f2c | |
433 | @cindex status, compilation | |
434 | @cindex compilation, status | |
435 | @cindex reporting compilation status | |
436 | @cindex printing compilation status | |
437 | @item -fno-silent | |
438 | Print (to @code{stderr}) the names of the program units as | |
439 | they are compiled, in a form similar to that used by popular | |
440 | UNIX @command{f77} implementations and @command{f2c} | |
441 | @end table | |
442 | ||
443 | @xref{Overall Options,,Options Controlling the Kind of Output, | |
444 | gcc,Using the GNU Compiler Collection (GCC)}, for information | |
445 | on more options that control the overall operation of the @command{gcc} command | |
446 | (and, by extension, the @command{g77} command). | |
447 | ||
448 | @node Shorthand Options | |
449 | @section Shorthand Options | |
450 | @cindex shorthand options | |
451 | @cindex options, shorthand | |
452 | @cindex macro options | |
453 | @cindex options, macro | |
454 | ||
455 | The following options serve as ``shorthand'' | |
456 | for other options accepted by the compiler: | |
457 | ||
458 | @table @gcctabopt | |
459 | @cindex -fugly option | |
460 | @cindex options, -fugly | |
461 | @item -fugly | |
462 | @cindex ugly features | |
463 | @cindex features, ugly | |
464 | @emph{Note:} This option is no longer supported. | |
465 | The information, below, is provided to aid | |
466 | in the conversion of old scripts. | |
467 | ||
468 | Specify that certain ``ugly'' constructs are to be quietly accepted. | |
469 | Same as: | |
470 | ||
471 | @smallexample | |
472 | -fugly-args -fugly-assign -fugly-assumed | |
473 | -fugly-comma -fugly-complex -fugly-init | |
474 | -fugly-logint | |
475 | @end smallexample | |
476 | ||
477 | These constructs are considered inappropriate to use in new | |
478 | or well-maintained portable Fortran code, but widely used | |
479 | in old code. | |
480 | @xref{Distensions}, for more information. | |
481 | ||
482 | @cindex -fno-ugly option | |
483 | @cindex options, -fno-ugly | |
484 | @item -fno-ugly | |
485 | @cindex ugly features | |
486 | @cindex features, ugly | |
487 | Specify that all ``ugly'' constructs are to be noisily rejected. | |
488 | Same as: | |
489 | ||
490 | @smallexample | |
491 | -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed | |
492 | -fno-ugly-comma -fno-ugly-complex -fno-ugly-init | |
493 | -fno-ugly-logint | |
494 | @end smallexample | |
495 | ||
496 | @xref{Distensions}, for more information. | |
497 | ||
498 | @cindex -ff66 option | |
499 | @cindex options, -ff66 | |
500 | @item -ff66 | |
501 | @cindex FORTRAN 66 | |
502 | @cindex compatibility, FORTRAN 66 | |
503 | Specify that the program is written in idiomatic FORTRAN 66. | |
504 | Same as @samp{-fonetrip -fugly-assumed}. | |
505 | ||
506 | The @option{-fno-f66} option is the inverse of @option{-ff66}. | |
507 | As such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}. | |
508 | ||
509 | The meaning of this option is likely to be refined as future | |
510 | versions of @command{g77} provide more compatibility with other | |
511 | existing and obsolete Fortran implementations. | |
512 | ||
513 | @cindex -ff77 option | |
514 | @cindex options, -ff77 | |
515 | @item -ff77 | |
516 | @cindex UNIX f77 | |
517 | @cindex f2c compatibility | |
518 | @cindex compatibility, f2c | |
519 | @cindex f77 compatibility | |
520 | @cindex compatibility, f77 | |
521 | Specify that the program is written in idiomatic UNIX FORTRAN 77 | |
522 | and/or the dialect accepted by the @command{f2c} product. | |
523 | Same as @samp{-fbackslash -fno-typeless-boz}. | |
524 | ||
525 | The meaning of this option is likely to be refined as future | |
526 | versions of @command{g77} provide more compatibility with other | |
527 | existing and obsolete Fortran implementations. | |
528 | ||
529 | @cindex -fno-f77 option | |
530 | @cindex options, -fno-f77 | |
531 | @item -fno-f77 | |
532 | @cindex UNIX f77 | |
533 | The @option{-fno-f77} option is @emph{not} the inverse | |
534 | of @option{-ff77}. | |
535 | It specifies that the program is not written in idiomatic UNIX | |
536 | FORTRAN 77 or @command{f2c} but in a more widely portable dialect. | |
537 | @option{-fno-f77} is the same as @option{-fno-backslash}. | |
538 | ||
539 | The meaning of this option is likely to be refined as future | |
540 | versions of @command{g77} provide more compatibility with other | |
541 | existing and obsolete Fortran implementations. | |
542 | @end table | |
543 | ||
544 | @node Fortran Dialect Options | |
545 | @section Options Controlling Fortran Dialect | |
546 | @cindex dialect options | |
547 | @cindex language, dialect options | |
548 | @cindex options, dialect | |
549 | ||
550 | The following options control the dialect of Fortran | |
551 | that the compiler accepts: | |
552 | ||
553 | @table @gcctabopt | |
554 | @cindex -ffree-form option | |
555 | @cindex options, -ffree-form | |
556 | @cindex -fno-fixed-form option | |
557 | @cindex options, -fno-fixed-form | |
558 | @cindex source file format | |
559 | @cindex free form | |
560 | @cindex fixed form | |
561 | @cindex Fortran 90, features | |
562 | @item -ffree-form | |
563 | @item -fno-fixed-form | |
564 | Specify that the source file is written in free form | |
565 | (introduced in Fortran 90) instead of the more-traditional fixed form. | |
566 | ||
567 | @cindex -ff90 option | |
568 | @cindex options, -ff90 | |
569 | @cindex Fortran 90, features | |
570 | @item -ff90 | |
571 | Allow certain Fortran-90 constructs. | |
572 | ||
573 | This option controls whether certain | |
574 | Fortran 90 constructs are recognized. | |
575 | (Other Fortran 90 constructs | |
576 | might or might not be recognized depending on other options such as | |
577 | @option{-fvxt}, @option{-ff90-intrinsics-enable}, and the | |
578 | current level of support for Fortran 90.) | |
579 | ||
580 | @xref{Fortran 90}, for more information. | |
581 | ||
582 | @cindex -fvxt option | |
583 | @cindex options, -fvxt | |
584 | @item -fvxt | |
585 | @cindex Fortran 90, features | |
586 | @cindex VXT extensions | |
587 | Specify the treatment of certain constructs that have different | |
588 | meanings depending on whether the code is written in | |
589 | GNU Fortran (based on FORTRAN 77 and akin to Fortran 90) | |
590 | or VXT Fortran (more like VAX FORTRAN). | |
591 | ||
592 | The default is @option{-fno-vxt}. | |
593 | @option{-fvxt} specifies that the VXT Fortran interpretations | |
594 | for those constructs are to be chosen. | |
595 | ||
596 | @xref{VXT Fortran}, for more information. | |
597 | ||
598 | @cindex -fdollar-ok option | |
599 | @cindex options, -fdollar-ok | |
600 | @item -fdollar-ok | |
601 | @cindex dollar sign | |
602 | @cindex symbol names | |
603 | @cindex character set | |
604 | Allow @samp{$} as a valid character in a symbol name. | |
605 | ||
606 | @cindex -fno-backslash option | |
607 | @cindex options, -fno-backslash | |
608 | @item -fno-backslash | |
609 | @cindex backslash | |
610 | @cindex character constants | |
611 | @cindex Hollerith constants | |
612 | Specify that @samp{\} is not to be specially interpreted in character | |
613 | and Hollerith constants a la C and many UNIX Fortran compilers. | |
614 | ||
615 | For example, with @option{-fbackslash} in effect, @samp{A\nB} specifies | |
616 | three characters, with the second one being newline. | |
617 | With @option{-fno-backslash}, it specifies four characters, | |
618 | @samp{A}, @samp{\}, @samp{n}, and @samp{B}. | |
619 | ||
620 | Note that @command{g77} implements a fairly general form of backslash | |
621 | processing that is incompatible with the narrower forms supported | |
622 | by some other compilers. | |
623 | For example, @samp{'A\003B'} is a three-character string in @command{g77} | |
624 | whereas other compilers that support backslash might not support | |
625 | the three-octal-digit form, and thus treat that string as longer | |
626 | than three characters. | |
627 | ||
628 | @xref{Backslash in Constants}, for | |
629 | information on why @option{-fbackslash} is the default | |
630 | instead of @option{-fno-backslash}. | |
631 | ||
632 | @cindex -fno-ugly-args option | |
633 | @cindex options, -fno-ugly-args | |
634 | @item -fno-ugly-args | |
635 | Disallow passing Hollerith and typeless constants as actual | |
636 | arguments (for example, @samp{CALL FOO(4HABCD)}). | |
637 | ||
638 | @xref{Ugly Implicit Argument Conversion}, for more information. | |
639 | ||
640 | @cindex -fugly-assign option | |
641 | @cindex options, -fugly-assign | |
642 | @item -fugly-assign | |
643 | Use the same storage for a given variable regardless of | |
644 | whether it is used to hold an assigned-statement label | |
645 | (as in @samp{ASSIGN 10 TO I}) or used to hold numeric data | |
646 | (as in @samp{I = 3}). | |
647 | ||
648 | @xref{Ugly Assigned Labels}, for more information. | |
649 | ||
650 | @cindex -fugly-assumed option | |
651 | @cindex options, -fugly-assumed | |
652 | @item -fugly-assumed | |
653 | Assume any dummy array with a final dimension specified as @samp{1} | |
654 | is really an assumed-size array, as if @samp{*} had been specified | |
655 | for the final dimension instead of @samp{1}. | |
656 | ||
657 | For example, @samp{DIMENSION X(1)} is treated as if it | |
658 | had read @samp{DIMENSION X(*)}. | |
659 | ||
660 | @xref{Ugly Assumed-Size Arrays}, for more information. | |
661 | ||
662 | @cindex -fugly-comma option | |
663 | @cindex options, -fugly-comma | |
664 | @item -fugly-comma | |
665 | In an external-procedure invocation, | |
666 | treat a trailing comma in the argument list | |
667 | as specification of a trailing null argument, | |
668 | and treat an empty argument list | |
669 | as specification of a single null argument. | |
670 | ||
671 | For example, @samp{CALL FOO(,)} is treated as | |
672 | @samp{CALL FOO(%VAL(0), %VAL(0))}. | |
673 | That is, @emph{two} null arguments are specified | |
674 | by the procedure call when @option{-fugly-comma} is in force. | |
675 | And @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}. | |
676 | ||
677 | The default behavior, @option{-fno-ugly-comma}, is to ignore | |
678 | a single trailing comma in an argument list. | |
679 | So, by default, @samp{CALL FOO(X,)} is treated | |
680 | exactly the same as @samp{CALL FOO(X)}. | |
681 | ||
682 | @xref{Ugly Null Arguments}, for more information. | |
683 | ||
684 | @cindex -fugly-complex option | |
685 | @cindex options, -fugly-complex | |
686 | @item -fugly-complex | |
687 | Do not complain about @samp{REAL(@var{expr})} or | |
688 | @samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX} | |
689 | type other than @code{COMPLEX(KIND=1)}---usually | |
690 | this is used to permit @code{COMPLEX(KIND=2)} | |
691 | (@code{DOUBLE COMPLEX}) operands. | |
692 | ||
693 | The @option{-ff90} option controls the interpretation | |
694 | of this construct. | |
695 | ||
696 | @xref{Ugly Complex Part Extraction}, for more information. | |
697 | ||
698 | @cindex -fno-ugly-init option | |
699 | @cindex options, -fno-ugly-init | |
700 | @item -fno-ugly-init | |
701 | Disallow use of Hollerith and typeless constants as initial | |
702 | values (in @code{PARAMETER} and @code{DATA} statements), and | |
703 | use of character constants to | |
704 | initialize numeric types and vice versa. | |
705 | ||
706 | For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by | |
707 | @option{-fno-ugly-init}. | |
708 | ||
709 | @xref{Ugly Conversion of Initializers}, for more information. | |
710 | ||
711 | @cindex -fugly-logint option | |
712 | @cindex options, -fugly-logint | |
713 | @item -fugly-logint | |
714 | Treat @code{INTEGER} and @code{LOGICAL} variables and | |
715 | expressions as potential stand-ins for each other. | |
716 | ||
717 | For example, automatic conversion between @code{INTEGER} and | |
718 | @code{LOGICAL} is enabled, for many contexts, via this option. | |
719 | ||
720 | @xref{Ugly Integer Conversions}, for more information. | |
721 | ||
722 | @cindex -fonetrip option | |
723 | @cindex options, -fonetrip | |
724 | @item -fonetrip | |
725 | @cindex FORTRAN 66 | |
726 | @cindex @code{DO} loops, one-trip | |
727 | @cindex one-trip @code{DO} loops | |
728 | @cindex @code{DO} loops, zero-trip | |
729 | @cindex zero-trip @code{DO} loops | |
730 | @cindex compatibility, FORTRAN 66 | |
731 | Executable iterative @code{DO} loops are to be executed at | |
732 | least once each time they are reached. | |
733 | ||
734 | ANSI FORTRAN 77 and more recent versions of the Fortran standard | |
735 | specify that the body of an iterative @code{DO} loop is not executed | |
736 | if the number of iterations calculated from the parameters of the | |
737 | loop is less than 1. | |
738 | (For example, @samp{DO 10 I = 1, 0}.) | |
739 | Such a loop is called a @dfn{zero-trip loop}. | |
740 | ||
741 | Prior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops | |
742 | such that the body of a loop would be executed at least once, even | |
743 | if the iteration count was zero. | |
744 | Fortran code written assuming this behavior is said to require | |
745 | @dfn{one-trip loops}. | |
746 | For example, some code written to the FORTRAN 66 standard | |
747 | expects this behavior from its @code{DO} loops, although that | |
748 | standard did not specify this behavior. | |
749 | ||
750 | The @option{-fonetrip} option specifies that the source file(s) being | |
751 | compiled require one-trip loops. | |
752 | ||
753 | This option affects only those loops specified by the (iterative) @code{DO} | |
754 | statement and by implied-@code{DO} lists in I/O statements. | |
755 | Loops specified by implied-@code{DO} lists in @code{DATA} and | |
756 | specification (non-executable) statements are not affected. | |
757 | ||
758 | @cindex -ftypeless-boz option | |
759 | @cindex options, -ftypeless-boz | |
760 | @cindex prefix-radix constants | |
761 | @cindex constants, prefix-radix | |
762 | @cindex constants, types | |
763 | @cindex types, constants | |
764 | @item -ftypeless-boz | |
765 | Specifies that prefix-radix non-decimal constants, such as | |
766 | @samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}. | |
767 | ||
768 | You can test for yourself whether a particular compiler treats | |
769 | the prefix form as @code{INTEGER(KIND=1)} or typeless by running the | |
770 | following program: | |
771 | ||
772 | @smallexample | |
773 | EQUIVALENCE (I, R) | |
774 | R = Z'ABCD1234' | |
775 | J = Z'ABCD1234' | |
776 | IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS' | |
777 | IF (J .NE. I) PRINT *, 'Prefix form is INTEGER' | |
778 | END | |
779 | @end smallexample | |
780 | ||
781 | Reports indicate that many compilers process this form as | |
782 | @code{INTEGER(KIND=1)}, though a few as typeless, and at least one | |
783 | based on a command-line option specifying some kind of | |
784 | compatibility. | |
785 | ||
786 | @cindex -fintrin-case-initcap option | |
787 | @cindex options, -fintrin-case-initcap | |
788 | @item -fintrin-case-initcap | |
789 | @cindex -fintrin-case-upper option | |
790 | @cindex options, -fintrin-case-upper | |
791 | @item -fintrin-case-upper | |
792 | @cindex -fintrin-case-lower option | |
793 | @cindex options, -fintrin-case-lower | |
794 | @item -fintrin-case-lower | |
795 | @cindex -fintrin-case-any option | |
796 | @cindex options, -fintrin-case-any | |
797 | @item -fintrin-case-any | |
798 | Specify expected case for intrinsic names. | |
799 | @option{-fintrin-case-lower} is the default. | |
800 | ||
801 | @cindex -fmatch-case-initcap option | |
802 | @cindex options, -fmatch-case-initcap | |
803 | @item -fmatch-case-initcap | |
804 | @cindex -fmatch-case-upper option | |
805 | @cindex options, -fmatch-case-upper | |
806 | @item -fmatch-case-upper | |
807 | @cindex -fmatch-case-lower option | |
808 | @cindex options, -fmatch-case-lower | |
809 | @item -fmatch-case-lower | |
810 | @cindex -fmatch-case-any option | |
811 | @cindex options, -fmatch-case-any | |
812 | @item -fmatch-case-any | |
813 | Specify expected case for keywords. | |
814 | @option{-fmatch-case-lower} is the default. | |
815 | ||
816 | @cindex -fsource-case-upper option | |
817 | @cindex options, -fsource-case-upper | |
818 | @item -fsource-case-upper | |
819 | @cindex -fsource-case-lower option | |
820 | @cindex options, -fsource-case-lower | |
821 | @item -fsource-case-lower | |
822 | @cindex -fsource-case-preserve option | |
823 | @cindex options, -fsource-case-preserve | |
824 | @item -fsource-case-preserve | |
825 | Specify whether source text other than character and Hollerith constants | |
826 | is to be translated to uppercase, to lowercase, or preserved as is. | |
827 | @option{-fsource-case-lower} is the default. | |
828 | ||
829 | @cindex -fsymbol-case-initcap option | |
830 | @cindex options, -fsymbol-case-initcap | |
831 | @item -fsymbol-case-initcap | |
832 | @cindex -fsymbol-case-upper option | |
833 | @cindex options, -fsymbol-case-upper | |
834 | @item -fsymbol-case-upper | |
835 | @cindex -fsymbol-case-lower option | |
836 | @cindex options, -fsymbol-case-lower | |
837 | @item -fsymbol-case-lower | |
838 | @cindex -fsymbol-case-any option | |
839 | @cindex options, -fsymbol-case-any | |
840 | @item -fsymbol-case-any | |
841 | Specify valid cases for user-defined symbol names. | |
842 | @option{-fsymbol-case-any} is the default. | |
843 | ||
844 | @cindex -fcase-strict-upper option | |
845 | @cindex options, -fcase-strict-upper | |
846 | @item -fcase-strict-upper | |
847 | Same as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve | |
848 | -fsymbol-case-upper}. | |
849 | (Requires all pertinent source to be in uppercase.) | |
850 | ||
851 | @cindex -fcase-strict-lower option | |
852 | @cindex options, -fcase-strict-lower | |
853 | @item -fcase-strict-lower | |
854 | Same as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve | |
855 | -fsymbol-case-lower}. | |
856 | (Requires all pertinent source to be in lowercase.) | |
857 | ||
858 | @cindex -fcase-initcap option | |
859 | @cindex options, -fcase-initcap | |
860 | @item -fcase-initcap | |
861 | Same as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve | |
862 | -fsymbol-case-initcap}. | |
863 | (Requires all pertinent source to be in initial capitals, | |
864 | as in @samp{Print *,SqRt(Value)}.) | |
865 | ||
866 | @cindex -fcase-upper option | |
867 | @cindex options, -fcase-upper | |
868 | @item -fcase-upper | |
869 | Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper | |
870 | -fsymbol-case-any}. | |
871 | (Maps all pertinent source to uppercase.) | |
872 | ||
873 | @cindex -fcase-lower option | |
874 | @cindex options, -fcase-lower | |
875 | @item -fcase-lower | |
876 | Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower | |
877 | -fsymbol-case-any}. | |
878 | (Maps all pertinent source to lowercase.) | |
879 | ||
880 | @cindex -fcase-preserve option | |
881 | @cindex options, -fcase-preserve | |
882 | @item -fcase-preserve | |
883 | Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-preserve | |
884 | -fsymbol-case-any}. | |
885 | (Preserves all case in user-defined symbols, | |
886 | while allowing any-case matching of intrinsics and keywords. | |
887 | For example, @samp{call Foo(i,I)} would pass two @emph{different} | |
888 | variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.) | |
889 | ||
890 | @cindex -fbadu77-intrinsics-delete option | |
891 | @cindex options, -fbadu77-intrinsics-delete | |
892 | @item -fbadu77-intrinsics-delete | |
893 | @cindex -fbadu77-intrinsics-hide option | |
894 | @cindex options, -fbadu77-intrinsics-hide | |
895 | @item -fbadu77-intrinsics-hide | |
896 | @cindex -fbadu77-intrinsics-disable option | |
897 | @cindex options, -fbadu77-intrinsics-disable | |
898 | @item -fbadu77-intrinsics-disable | |
899 | @cindex -fbadu77-intrinsics-enable option | |
900 | @cindex options, -fbadu77-intrinsics-enable | |
901 | @item -fbadu77-intrinsics-enable | |
902 | @cindex @code{badu77} intrinsics | |
903 | @cindex intrinsics, @code{badu77} | |
904 | Specify status of UNIX intrinsics having inappropriate forms. | |
905 | @option{-fbadu77-intrinsics-enable} is the default. | |
906 | @xref{Intrinsic Groups}. | |
907 | ||
908 | @cindex -ff2c-intrinsics-delete option | |
909 | @cindex options, -ff2c-intrinsics-delete | |
910 | @item -ff2c-intrinsics-delete | |
911 | @cindex -ff2c-intrinsics-hide option | |
912 | @cindex options, -ff2c-intrinsics-hide | |
913 | @item -ff2c-intrinsics-hide | |
914 | @cindex -ff2c-intrinsics-disable option | |
915 | @cindex options, -ff2c-intrinsics-disable | |
916 | @item -ff2c-intrinsics-disable | |
917 | @cindex -ff2c-intrinsics-enable option | |
918 | @cindex options, -ff2c-intrinsics-enable | |
919 | @item -ff2c-intrinsics-enable | |
920 | @cindex @command{f2c} intrinsics | |
921 | @cindex intrinsics, @command{f2c} | |
922 | Specify status of f2c-specific intrinsics. | |
923 | @option{-ff2c-intrinsics-enable} is the default. | |
924 | @xref{Intrinsic Groups}. | |
925 | ||
926 | @cindex -ff90-intrinsics-delete option | |
927 | @cindex options, -ff90-intrinsics-delete | |
928 | @item -ff90-intrinsics-delete | |
929 | @cindex -ff90-intrinsics-hide option | |
930 | @cindex options, -ff90-intrinsics-hide | |
931 | @item -ff90-intrinsics-hide | |
932 | @cindex -ff90-intrinsics-disable option | |
933 | @cindex options, -ff90-intrinsics-disable | |
934 | @item -ff90-intrinsics-disable | |
935 | @cindex -ff90-intrinsics-enable option | |
936 | @cindex options, -ff90-intrinsics-enable | |
937 | @item -ff90-intrinsics-enable | |
938 | @cindex Fortran 90, intrinsics | |
939 | @cindex intrinsics, Fortran 90 | |
940 | Specify status of F90-specific intrinsics. | |
941 | @option{-ff90-intrinsics-enable} is the default. | |
942 | @xref{Intrinsic Groups}. | |
943 | ||
944 | @cindex -fgnu-intrinsics-delete option | |
945 | @cindex options, -fgnu-intrinsics-delete | |
946 | @item -fgnu-intrinsics-delete | |
947 | @cindex -fgnu-intrinsics-hide option | |
948 | @cindex options, -fgnu-intrinsics-hide | |
949 | @item -fgnu-intrinsics-hide | |
950 | @cindex -fgnu-intrinsics-disable option | |
951 | @cindex options, -fgnu-intrinsics-disable | |
952 | @item -fgnu-intrinsics-disable | |
953 | @cindex -fgnu-intrinsics-enable option | |
954 | @cindex options, -fgnu-intrinsics-enable | |
955 | @item -fgnu-intrinsics-enable | |
956 | @cindex Digital Fortran features | |
957 | @cindex @code{COMPLEX} intrinsics | |
958 | @cindex intrinsics, @code{COMPLEX} | |
959 | Specify status of Digital's COMPLEX-related intrinsics. | |
960 | @option{-fgnu-intrinsics-enable} is the default. | |
961 | @xref{Intrinsic Groups}. | |
962 | ||
963 | @cindex -fmil-intrinsics-delete option | |
964 | @cindex options, -fmil-intrinsics-delete | |
965 | @item -fmil-intrinsics-delete | |
966 | @cindex -fmil-intrinsics-hide option | |
967 | @cindex options, -fmil-intrinsics-hide | |
968 | @item -fmil-intrinsics-hide | |
969 | @cindex -fmil-intrinsics-disable option | |
970 | @cindex options, -fmil-intrinsics-disable | |
971 | @item -fmil-intrinsics-disable | |
972 | @cindex -fmil-intrinsics-enable option | |
973 | @cindex options, -fmil-intrinsics-enable | |
974 | @item -fmil-intrinsics-enable | |
975 | @cindex MIL-STD 1753 | |
976 | @cindex intrinsics, MIL-STD 1753 | |
977 | Specify status of MIL-STD-1753-specific intrinsics. | |
978 | @option{-fmil-intrinsics-enable} is the default. | |
979 | @xref{Intrinsic Groups}. | |
980 | ||
981 | @cindex -funix-intrinsics-delete option | |
982 | @cindex options, -funix-intrinsics-delete | |
983 | @item -funix-intrinsics-delete | |
984 | @cindex -funix-intrinsics-hide option | |
985 | @cindex options, -funix-intrinsics-hide | |
986 | @item -funix-intrinsics-hide | |
987 | @cindex -funix-intrinsics-disable option | |
988 | @cindex options, -funix-intrinsics-disable | |
989 | @item -funix-intrinsics-disable | |
990 | @cindex -funix-intrinsics-enable option | |
991 | @cindex options, -funix-intrinsics-enable | |
992 | @item -funix-intrinsics-enable | |
993 | @cindex UNIX intrinsics | |
994 | @cindex intrinsics, UNIX | |
995 | Specify status of UNIX intrinsics. | |
996 | @option{-funix-intrinsics-enable} is the default. | |
997 | @xref{Intrinsic Groups}. | |
998 | ||
999 | @cindex -fvxt-intrinsics-delete option | |
1000 | @cindex options, -fvxt-intrinsics-delete | |
1001 | @item -fvxt-intrinsics-delete | |
1002 | @cindex -fvxt-intrinsics-hide option | |
1003 | @cindex options, -fvxt-intrinsics-hide | |
1004 | @item -fvxt-intrinsics-hide | |
1005 | @cindex -fvxt-intrinsics-disable option | |
1006 | @cindex options, -fvxt-intrinsics-disable | |
1007 | @item -fvxt-intrinsics-disable | |
1008 | @cindex -fvxt-intrinsics-enable option | |
1009 | @cindex options, -fvxt-intrinsics-enable | |
1010 | @item -fvxt-intrinsics-enable | |
1011 | @cindex VXT intrinsics | |
1012 | @cindex intrinsics, VXT | |
1013 | Specify status of VXT intrinsics. | |
1014 | @option{-fvxt-intrinsics-enable} is the default. | |
1015 | @xref{Intrinsic Groups}. | |
1016 | ||
1017 | @cindex -ffixed-line-length-@var{n} option | |
1018 | @cindex options, -ffixed-line-length-@var{n} | |
1019 | @item -ffixed-line-length-@var{n} | |
1020 | @cindex source file format | |
1021 | @cindex lines, length | |
1022 | @cindex length of source lines | |
1023 | @cindex fixed form | |
1024 | @cindex limits, lengths of source lines | |
1025 | Set column after which characters are ignored in typical fixed-form | |
1026 | lines in the source file, and through which spaces are assumed (as | |
1027 | if padded to that length) after the ends of short fixed-form lines. | |
1028 | ||
1029 | @cindex card image | |
1030 | @cindex extended-source option | |
1031 | Popular values for @var{n} include 72 (the | |
1032 | standard and the default), 80 (card image), and 132 (corresponds | |
1033 | to ``extended-source'' options in some popular compilers). | |
1034 | @var{n} may be @samp{none}, meaning that the entire line is meaningful | |
1035 | and that continued character constants never have implicit spaces appended | |
1036 | to them to fill out the line. | |
1037 | @option{-ffixed-line-length-0} means the same thing as | |
1038 | @option{-ffixed-line-length-none}. | |
1039 | ||
1040 | @xref{Source Form}, for more information. | |
1041 | @end table | |
1042 | ||
1043 | @node Warning Options | |
1044 | @section Options to Request or Suppress Warnings | |
1045 | @cindex options, warnings | |
1046 | @cindex warnings, suppressing | |
1047 | @cindex messages, warning | |
1048 | @cindex suppressing warnings | |
1049 | ||
1050 | Warnings are diagnostic messages that report constructions which | |
1051 | are not inherently erroneous but which are risky or suggest there | |
1052 | might have been an error. | |
1053 | ||
1054 | You can request many specific warnings with options beginning @option{-W}, | |
1055 | for example @option{-Wimplicit} to request warnings on implicit | |
1056 | declarations. Each of these specific warning options also has a | |
1057 | negative form beginning @option{-Wno-} to turn off warnings; | |
1058 | for example, @option{-Wno-implicit}. This manual lists only one of the | |
1059 | two forms, whichever is not the default. | |
1060 | ||
1061 | These options control the amount and kinds of warnings produced by GNU | |
1062 | Fortran: | |
1063 | ||
1064 | @table @gcctabopt | |
1065 | @cindex syntax checking | |
1066 | @cindex -fsyntax-only option | |
1067 | @cindex options, -fsyntax-only | |
1068 | @item -fsyntax-only | |
1069 | Check the code for syntax errors, but don't do anything beyond that. | |
1070 | ||
1071 | @cindex -pedantic option | |
1072 | @cindex options, -pedantic | |
1073 | @item -pedantic | |
1074 | Issue warnings for uses of extensions to ANSI FORTRAN 77. | |
1075 | @option{-pedantic} also applies to C-language constructs where they | |
1076 | occur in GNU Fortran source files, such as use of @samp{\e} in a | |
1077 | character constant within a directive like @samp{#include}. | |
1078 | ||
1079 | Valid ANSI FORTRAN 77 programs should compile properly with or without | |
1080 | this option. | |
1081 | However, without this option, certain GNU extensions and traditional | |
1082 | Fortran features are supported as well. | |
1083 | With this option, many of them are rejected. | |
1084 | ||
1085 | Some users try to use @option{-pedantic} to check programs for strict ANSI | |
1086 | conformance. | |
1087 | They soon find that it does not do quite what they want---it finds some | |
1088 | non-ANSI practices, but not all. | |
1089 | However, improvements to @command{g77} in this area are welcome. | |
1090 | ||
1091 | @cindex -pedantic-errors option | |
1092 | @cindex options, -pedantic-errors | |
1093 | @item -pedantic-errors | |
1094 | Like @option{-pedantic}, except that errors are produced rather than | |
1095 | warnings. | |
1096 | ||
1097 | @cindex -fpedantic option | |
1098 | @cindex options, -fpedantic | |
1099 | @item -fpedantic | |
1100 | Like @option{-pedantic}, but applies only to Fortran constructs. | |
1101 | ||
1102 | @cindex -w option | |
1103 | @cindex options, -w | |
1104 | @item -w | |
1105 | Inhibit all warning messages. | |
1106 | ||
1107 | @cindex -Wno-globals option | |
1108 | @cindex options, -Wno-globals | |
1109 | @item -Wno-globals | |
1110 | @cindex global names, warning | |
1111 | @cindex warnings, global names | |
1112 | Inhibit warnings about use of a name as both a global name | |
1113 | (a subroutine, function, or block data program unit, or a | |
1114 | common block) and implicitly as the name of an intrinsic | |
1115 | in a source file. | |
1116 | ||
1117 | Also inhibit warnings about inconsistent invocations and/or | |
1118 | definitions of global procedures (function and subroutines). | |
1119 | Such inconsistencies include different numbers of arguments | |
1120 | and different types of arguments. | |
1121 | ||
1122 | @cindex -Wimplicit option | |
1123 | @cindex options, -Wimplicit | |
1124 | @item -Wimplicit | |
1125 | @cindex implicit declaration, warning | |
1126 | @cindex warnings, implicit declaration | |
1127 | @cindex -u option | |
1128 | @cindex /WARNINGS=DECLARATIONS switch | |
1129 | @cindex IMPLICIT NONE, similar effect | |
1130 | @cindex effecting IMPLICIT NONE | |
1131 | Warn whenever a variable, array, or function is implicitly | |
1132 | declared. | |
1133 | Has an effect similar to using the @code{IMPLICIT NONE} statement | |
1134 | in every program unit. | |
1135 | (Some Fortran compilers provide this feature by an option | |
1136 | named @option{-u} or @samp{/WARNINGS=DECLARATIONS}.) | |
1137 | ||
1138 | @cindex -Wunused option | |
1139 | @cindex options, -Wunused | |
1140 | @item -Wunused | |
1141 | @cindex unused variables | |
1142 | @cindex variables, unused | |
1143 | Warn whenever a variable is unused aside from its declaration. | |
1144 | ||
1145 | @cindex -Wuninitialized option | |
1146 | @cindex options, -Wuninitialized | |
1147 | @item -Wuninitialized | |
1148 | @cindex uninitialized variables | |
1149 | @cindex variables, uninitialized | |
1150 | Warn whenever an automatic variable is used without first being initialized. | |
1151 | ||
1152 | These warnings are possible only in optimizing compilation, | |
1153 | because they require data-flow information that is computed only | |
1154 | when optimizing. If you don't specify @option{-O}, you simply won't | |
1155 | get these warnings. | |
1156 | ||
1157 | These warnings occur only for variables that are candidates for | |
1158 | register allocation. Therefore, they do not occur for a variable | |
1159 | @c that is declared @code{VOLATILE}, or | |
1160 | whose address is taken, or whose size | |
1161 | is other than 1, 2, 4 or 8 bytes. Also, they do not occur for | |
1162 | arrays, even when they are in registers. | |
1163 | ||
1164 | Note that there might be no warning about a variable that is used only | |
1165 | to compute a value that itself is never used, because such | |
1166 | computations may be deleted by data-flow analysis before the warnings | |
1167 | are printed. | |
1168 | ||
1169 | These warnings are made optional because GNU Fortran is not smart | |
1170 | enough to see all the reasons why the code might be correct | |
1171 | despite appearing to have an error. Here is one example of how | |
1172 | this can happen: | |
1173 | ||
1174 | @example | |
1175 | SUBROUTINE DISPAT(J) | |
1176 | IF (J.EQ.1) I=1 | |
1177 | IF (J.EQ.2) I=4 | |
1178 | IF (J.EQ.3) I=5 | |
1179 | CALL FOO(I) | |
1180 | END | |
1181 | @end example | |
1182 | ||
1183 | @noindent | |
1184 | If the value of @code{J} is always 1, 2 or 3, then @code{I} is | |
1185 | always initialized, but GNU Fortran doesn't know this. Here is | |
1186 | another common case: | |
1187 | ||
1188 | @example | |
1189 | SUBROUTINE MAYBE(FLAG) | |
1190 | LOGICAL FLAG | |
1191 | IF (FLAG) VALUE = 9.4 | |
1192 | @dots{} | |
1193 | IF (FLAG) PRINT *, VALUE | |
1194 | END | |
1195 | @end example | |
1196 | ||
1197 | @noindent | |
1198 | This has no bug because @code{VALUE} is used only if it is set. | |
1199 | ||
1200 | @cindex -Wall option | |
1201 | @cindex options, -Wall | |
1202 | @item -Wall | |
1203 | @cindex all warnings | |
1204 | @cindex warnings, all | |
1205 | The @option{-Wunused} and @option{-Wuninitialized} options combined. | |
1206 | These are all the | |
1207 | options which pertain to usage that we recommend avoiding and that we | |
1208 | believe is easy to avoid. | |
1209 | (As more warnings are added to @command{g77} some might | |
1210 | be added to the list enabled by @option{-Wall}.) | |
1211 | @end table | |
1212 | ||
1213 | The remaining @option{-W@dots{}} options are not implied by @option{-Wall} | |
1214 | because they warn about constructions that we consider reasonable to | |
1215 | use, on occasion, in clean programs. | |
1216 | ||
1217 | @table @gcctabopt | |
1218 | @c @item -W | |
1219 | @c Print extra warning messages for these events: | |
1220 | @c | |
1221 | @c @itemize @bullet | |
1222 | @c @item | |
1223 | @c If @option{-Wall} or @option{-Wunused} is also specified, warn about unused | |
1224 | @c arguments. | |
1225 | @c | |
1226 | @c @end itemize | |
1227 | @c | |
1228 | @cindex -Wsurprising option | |
1229 | @cindex options, -Wsurprising | |
1230 | @item -Wsurprising | |
1231 | Warn about ``suspicious'' constructs that are interpreted | |
1232 | by the compiler in a way that might well be surprising to | |
1233 | someone reading the code. | |
1234 | These differences can result in subtle, compiler-dependent | |
1235 | (even machine-dependent) behavioral differences. | |
1236 | The constructs warned about include: | |
1237 | ||
1238 | @itemize @bullet | |
1239 | @item | |
1240 | Expressions having two arithmetic operators in a row, such | |
1241 | as @samp{X*-Y}. | |
1242 | Such a construct is nonstandard, and can produce | |
1243 | unexpected results in more complicated situations such | |
1244 | as @samp{X**-Y*Z}. | |
1245 | @command{g77} along with many other compilers, interprets | |
1246 | this example differently than many programmers, and a few | |
1247 | other compilers. | |
1248 | Specifically, @command{g77} interprets @samp{X**-Y*Z} as | |
1249 | @samp{(X**(-Y))*Z}, while others might think it should | |
1250 | be interpreted as @samp{X**(-(Y*Z))}. | |
1251 | ||
1252 | A revealing example is the constant expression @samp{2**-2*1.}, | |
1253 | which @command{g77} evaluates to .25, while others might evaluate | |
1254 | it to 0., the difference resulting from the way precedence affects | |
1255 | type promotion. | |
1256 | ||
1257 | (The @option{-fpedantic} option also warns about expressions | |
1258 | having two arithmetic operators in a row.) | |
1259 | ||
1260 | @item | |
1261 | Expressions with a unary minus followed by an operand and then | |
1262 | a binary operator other than plus or minus. | |
1263 | For example, @samp{-2**2} produces a warning, because | |
1264 | the precedence is @samp{-(2**2)}, yielding -4, not | |
1265 | @samp{(-2)**2}, which yields 4, and which might represent | |
1266 | what a programmer expects. | |
1267 | ||
1268 | An example of an expression producing different results | |
1269 | in a surprising way is @samp{-I*S}, where @var{I} holds | |
1270 | the value @samp{-2147483648} and @var{S} holds @samp{0.5}. | |
1271 | On many systems, negating @var{I} results in the same | |
1272 | value, not a positive number, because it is already the | |
1273 | lower bound of what an @code{INTEGER(KIND=1)} variable can hold. | |
1274 | So, the expression evaluates to a positive number, while | |
1275 | the ``expected'' interpretation, @samp{(-I)*S}, would | |
1276 | evaluate to a negative number. | |
1277 | ||
1278 | Even cases such as @samp{-I*J} produce warnings, | |
1279 | even though, in most configurations and situations, | |
1280 | there is no computational difference between the | |
1281 | results of the two interpretations---the purpose | |
1282 | of this warning is to warn about differing interpretations | |
1283 | and encourage a better style of coding, not to identify | |
1284 | only those places where bugs might exist in the user's | |
1285 | code. | |
1286 | ||
1287 | @cindex DO statement | |
1288 | @cindex statements, DO | |
1289 | @item | |
1290 | @code{DO} loops with @code{DO} variables that are not | |
1291 | of integral type---that is, using @code{REAL} | |
1292 | variables as loop control variables. | |
1293 | Although such loops can be written to work in the | |
1294 | ``obvious'' way, the way @command{g77} is required by the | |
1295 | Fortran standard to interpret such code is likely to | |
1296 | be quite different from the way many programmers expect. | |
1297 | (This is true of all @code{DO} loops, but the differences | |
1298 | are pronounced for non-integral loop control variables.) | |
1299 | ||
1300 | @xref{Loops}, for more information. | |
1301 | @end itemize | |
1302 | ||
1303 | @cindex -Werror option | |
1304 | @cindex options, -Werror | |
1305 | @item -Werror | |
1306 | Make all warnings into errors. | |
1307 | ||
1308 | @cindex -W option | |
1309 | @cindex options, -W | |
1310 | @item -W | |
1311 | @cindex extra warnings | |
1312 | @cindex warnings, extra | |
1313 | Turns on ``extra warnings'' and, if optimization is specified | |
1314 | via @option{-O}, the @option{-Wuninitialized} option. | |
1315 | (This might change in future versions of @command{g77} | |
1316 | ||
1317 | ``Extra warnings'' are issued for: | |
1318 | ||
1319 | @itemize @bullet | |
1320 | @item | |
1321 | @cindex unused parameters | |
1322 | @cindex parameters, unused | |
1323 | @cindex unused arguments | |
1324 | @cindex arguments, unused | |
1325 | @cindex unused dummies | |
1326 | @cindex dummies, unused | |
1327 | Unused parameters to a procedure (when @option{-Wunused} also is | |
1328 | specified). | |
1329 | ||
1330 | @item | |
1331 | @cindex overflow | |
1332 | Overflows involving floating-point constants (not available | |
1333 | for certain configurations). | |
1334 | @end itemize | |
1335 | @end table | |
1336 | ||
1337 | @xref{Warning Options,,Options to Request or Suppress Warnings, | |
1338 | gcc,Using the GNU Compiler Collection (GCC)}, for information on more | |
1339 | options offered | |
1340 | by the GBE shared by @command{g77} @command{gcc} and other GNU compilers. | |
1341 | ||
1342 | Some of these have no effect when compiling programs written in Fortran: | |
1343 | ||
1344 | @table @gcctabopt | |
1345 | @cindex -Wcomment option | |
1346 | @cindex options, -Wcomment | |
1347 | @item -Wcomment | |
1348 | @cindex -Wformat option | |
1349 | @cindex options, -Wformat | |
1350 | @item -Wformat | |
1351 | @cindex -Wparentheses option | |
1352 | @cindex options, -Wparentheses | |
1353 | @item -Wparentheses | |
1354 | @cindex -Wswitch option | |
1355 | @cindex options, -Wswitch | |
1356 | @item -Wswitch | |
1357 | @cindex -Wswitch-default option | |
1358 | @cindex options, -Wswitch-default | |
1359 | @item -Wswitch-default | |
1360 | @cindex -Wswitch-enum option | |
1361 | @cindex options, -Wswitch-enum | |
1362 | @item -Wswitch-enum | |
1363 | @cindex -Wtraditional option | |
1364 | @cindex options, -Wtraditional | |
1365 | @item -Wtraditional | |
1366 | @cindex -Wshadow option | |
1367 | @cindex options, -Wshadow | |
1368 | @item -Wshadow | |
1369 | @cindex -Wid-clash-@var{len} option | |
1370 | @cindex options, -Wid-clash-@var{len} | |
1371 | @item -Wid-clash-@var{len} | |
1372 | @cindex -Wlarger-than-@var{len} option | |
1373 | @cindex options, -Wlarger-than-@var{len} | |
1374 | @item -Wlarger-than-@var{len} | |
1375 | @cindex -Wconversion option | |
1376 | @cindex options, -Wconversion | |
1377 | @item -Wconversion | |
1378 | @cindex -Waggregate-return option | |
1379 | @cindex options, -Waggregate-return | |
1380 | @item -Waggregate-return | |
1381 | @cindex -Wredundant-decls option | |
1382 | @cindex options, -Wredundant-decls | |
1383 | @item -Wredundant-decls | |
1384 | @cindex unsupported warnings | |
1385 | @cindex warnings, unsupported | |
1386 | These options all could have some relevant meaning for | |
1387 | GNU Fortran programs, but are not yet supported. | |
1388 | @end table | |
1389 | ||
1390 | @node Debugging Options | |
1391 | @section Options for Debugging Your Program or GNU Fortran | |
1392 | @cindex options, debugging | |
1393 | @cindex debugging information options | |
1394 | ||
1395 | GNU Fortran has various special options that are used for debugging | |
1396 | either your program or @command{g77} | |
1397 | ||
1398 | @table @gcctabopt | |
1399 | @cindex -g option | |
1400 | @cindex options, -g | |
1401 | @item -g | |
1402 | Produce debugging information in the operating system's native format | |
1403 | (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging | |
1404 | information. | |
1405 | ||
1406 | A sample debugging session looks like this (note the use of the breakpoint): | |
1407 | @smallexample | |
1408 | $ cat gdb.f | |
1409 | PROGRAM PROG | |
1410 | DIMENSION A(10) | |
1411 | DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./ | |
1412 | A(5) = 4. | |
1413 | PRINT*,A | |
1414 | END | |
1415 | $ g77 -g -O gdb.f | |
1416 | $ gdb a.out | |
1417 | ... | |
1418 | (gdb) break MAIN__ | |
1419 | Breakpoint 1 at 0x8048e96: file gdb.f, line 4. | |
1420 | (gdb) run | |
1421 | Starting program: /home/toon/g77-bugs/./a.out | |
1422 | Breakpoint 1, MAIN__ () at gdb.f:4 | |
1423 | 4 A(5) = 4. | |
1424 | Current language: auto; currently fortran | |
1425 | (gdb) print a(5) | |
1426 | $1 = 5 | |
1427 | (gdb) step | |
1428 | 5 PRINT*,A | |
1429 | (gdb) print a(5) | |
1430 | $2 = 4 | |
1431 | ... | |
1432 | @end smallexample | |
1433 | One could also add the setting of the breakpoint and the first run command | |
1434 | to the file @file{.gdbinit} in the current directory, to simplify the debugging | |
1435 | session. | |
1436 | @end table | |
1437 | ||
1438 | @xref{Debugging Options,,Options for Debugging Your Program or GCC, | |
1439 | gcc,Using the GNU Compiler Collection (GCC)}, for more information on | |
1440 | debugging options. | |
1441 | ||
1442 | @node Optimize Options | |
1443 | @section Options That Control Optimization | |
1444 | @cindex optimize options | |
1445 | @cindex options, optimization | |
1446 | ||
1447 | Most Fortran users will want to use no optimization when | |
1448 | developing and testing programs, and use @option{-O} or @option{-O2} when | |
1449 | compiling programs for late-cycle testing and for production use. | |
1450 | However, note that certain diagnostics---such as for uninitialized | |
1451 | variables---depend on the flow analysis done by @option{-O}, i.e.@: you | |
1452 | must use @option{-O} or @option{-O2} to get such diagnostics. | |
1453 | ||
1454 | The following flags have particular applicability when | |
1455 | compiling Fortran programs: | |
1456 | ||
1457 | @table @gcctabopt | |
1458 | @cindex -malign-double option | |
1459 | @cindex options, -malign-double | |
1460 | @item -malign-double | |
1461 | (Intel x86 architecture only.) | |
1462 | ||
1463 | Noticeably improves performance of @command{g77} programs making | |
1464 | heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data | |
1465 | on some systems. | |
1466 | In particular, systems using Pentium, Pentium Pro, 586, and | |
1467 | 686 implementations | |
1468 | of the i386 architecture execute programs faster when | |
1469 | @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are | |
1470 | aligned on 64-bit boundaries | |
1471 | in memory. | |
1472 | ||
1473 | This option can, at least, make benchmark results more consistent | |
1474 | across various system configurations, versions of the program, | |
1475 | and data sets. | |
1476 | ||
1477 | @emph{Note:} The warning in the @command{gcc} documentation about | |
1478 | this option does not apply, generally speaking, to Fortran | |
1479 | code compiled by @command{g77} | |
1480 | ||
1481 | @xref{Aligned Data}, for more information on alignment issues. | |
1482 | ||
1483 | @emph{Also also note:} The negative form of @option{-malign-double} | |
1484 | is @option{-mno-align-double}, not @option{-benign-double}. | |
1485 | ||
1486 | @cindex -ffloat-store option | |
1487 | @cindex options, -ffloat-store | |
1488 | @item -ffloat-store | |
1489 | @cindex IEEE 754 conformance | |
1490 | @cindex conformance, IEEE 754 | |
1491 | @cindex floating-point, precision | |
1492 | Might help a Fortran program that depends on exact IEEE conformance on | |
1493 | some machines, but might slow down a program that doesn't. | |
1494 | ||
1495 | This option is effective when the floating-point unit is set to work in | |
1496 | IEEE 854 `extended precision'---as it typically is on x86 and m68k GNU | |
1497 | systems---rather than IEEE 754 double precision. @option{-ffloat-store} | |
1498 | tries to remove the extra precision by spilling data from floating-point | |
1499 | registers into memory and this typically involves a big performance | |
1500 | hit. However, it doesn't affect intermediate results, so that it is | |
1501 | only partially effective. `Excess precision' is avoided in code like: | |
1502 | @smallexample | |
1503 | a = b + c | |
1504 | d = a * e | |
1505 | @end smallexample | |
1506 | but not in code like: | |
1507 | @smallexample | |
1508 | d = (b + c) * e | |
1509 | @end smallexample | |
1510 | ||
1511 | For another, potentially better, way of controlling the precision, | |
1512 | see @ref{Floating-point precision}. | |
1513 | ||
1514 | @cindex -fforce-mem option | |
1515 | @cindex options, -fforce-mem | |
1516 | @item -fforce-mem | |
1517 | @cindex -fforce-addr option | |
1518 | @cindex options, -fforce-addr | |
1519 | @item -fforce-addr | |
1520 | @cindex loops, speeding up | |
1521 | @cindex speed, of loops | |
1522 | Might improve optimization of loops. | |
1523 | ||
1524 | @cindex -fno-inline option | |
1525 | @cindex options, -fno-inline | |
1526 | @item -fno-inline | |
1527 | @cindex in-line code | |
1528 | @cindex compilation, in-line | |
1529 | @c DL: Only relevant for -O3? TM: No, statement functions are | |
1530 | @c inlined even at -O1. | |
1531 | Don't compile statement functions inline. | |
1532 | Might reduce the size of a program unit---which might be at | |
1533 | expense of some speed (though it should compile faster). | |
1534 | Note that if you are not optimizing, no functions can be expanded inline. | |
1535 | ||
1536 | @cindex -ffast-math option | |
1537 | @cindex options, -ffast-math | |
1538 | @item -ffast-math | |
1539 | @cindex IEEE 754 conformance | |
1540 | @cindex conformance, IEEE 754 | |
1541 | Might allow some programs designed to not be too dependent | |
1542 | on IEEE behavior for floating-point to run faster, or die trying. | |
1543 | Sets @option{-funsafe-math-optimizations}, @option{-ffinite-math-only}, | |
1544 | and @option{-fno-trapping-math}. | |
1545 | ||
1546 | @cindex -funsafe-math-optimizations option | |
1547 | @cindex options, -funsafe-math-optimizations | |
1548 | @item -funsafe-math-optimizations | |
1549 | Allow optimizations that may be give incorrect results | |
1550 | for certain IEEE inputs. | |
1551 | ||
1552 | @cindex -ffinite-math-only option | |
1553 | @cindex options, -ffinite-math-only | |
1554 | @item -ffinite-math-only | |
1555 | Allow optimizations for floating-point arithmetic that assume | |
1556 | that arguments and results are not NaNs or +-Infs. | |
1557 | ||
1558 | This option should never be turned on by any @option{-O} option since | |
1559 | it can result in incorrect output for programs which depend on | |
1560 | an exact implementation of IEEE or ISO rules/specifications. | |
1561 | ||
1562 | The default is @option{-fno-finite-math-only}. | |
1563 | ||
1564 | @cindex -fno-trapping-math option | |
1565 | @cindex options, -fno-trapping-math | |
1566 | @item -fno-trapping-math | |
1567 | Allow the compiler to assume that floating-point arithmetic | |
1568 | will not generate traps on any inputs. This is useful, for | |
1569 | example, when running a program using IEEE "non-stop" | |
1570 | floating-point arithmetic. | |
1571 | ||
1572 | @cindex -fstrength-reduce option | |
1573 | @cindex options, -fstrength-reduce | |
1574 | @item -fstrength-reduce | |
1575 | @cindex loops, speeding up | |
1576 | @cindex speed, of loops | |
1577 | @c DL: normally defaulted? | |
1578 | Might make some loops run faster. | |
1579 | ||
1580 | @cindex -frerun-cse-after-loop option | |
1581 | @cindex options, -frerun-cse-after-loop | |
1582 | @item -frerun-cse-after-loop | |
1583 | @cindex -fexpensive-optimizations option | |
1584 | @cindex options, -fexpensive-optimizations | |
1585 | @c DL: This is -O2? | |
1586 | @item -fexpensive-optimizations | |
1587 | @cindex -fdelayed-branch option | |
1588 | @cindex options, -fdelayed-branch | |
1589 | @item -fdelayed-branch | |
1590 | @cindex -fschedule-insns option | |
1591 | @cindex options, -fschedule-insns | |
1592 | @item -fschedule-insns | |
1593 | @cindex -fschedule-insns2 option | |
1594 | @cindex options, -fschedule-insns2 | |
1595 | @item -fschedule-insns2 | |
1596 | @cindex -fcaller-saves option | |
1597 | @cindex options, -fcaller-saves | |
1598 | @item -fcaller-saves | |
1599 | Might improve performance on some code. | |
1600 | ||
1601 | @cindex -funroll-loops option | |
1602 | @cindex options, -funroll-loops | |
1603 | @item -funroll-loops | |
1604 | @cindex loops, unrolling | |
1605 | @cindex unrolling loops | |
1606 | @cindex loops, optimizing | |
1607 | @cindex indexed (iterative) @code{DO} | |
1608 | @cindex iterative @code{DO} | |
1609 | @c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to | |
1610 | @c provide a suitable term | |
1611 | @c CB: I've decided on `iterative', for the time being, and changed | |
1612 | @c my previous, rather bizarre, use of `imperative' to that | |
1613 | @c (though `precomputed-trip' would be a more precise adjective) | |
1614 | Typically improves performance on code using iterative @code{DO} loops by | |
1615 | unrolling them and is probably generally appropriate for Fortran, though | |
1616 | it is not turned on at any optimization level. | |
1617 | Note that outer loop unrolling isn't done specifically; decisions about | |
1618 | whether to unroll a loop are made on the basis of its instruction count. | |
1619 | ||
1620 | @c DL: Fixme: This should obviously go somewhere else... | |
1621 | Also, no `loop discovery'@footnote{@dfn{loop discovery} refers to the | |
1622 | process by which a compiler, or indeed any reader of a program, | |
1623 | determines which portions of the program are more likely to be executed | |
1624 | repeatedly as it is being run. Such discovery typically is done early | |
1625 | when compiling using optimization techniques, so the ``discovered'' | |
1626 | loops get more attention---and more run-time resources, such as | |
1627 | registers---from the compiler. It is easy to ``discover'' loops that are | |
1628 | constructed out of looping constructs in the language | |
1629 | (such as Fortran's @code{DO}). For some programs, ``discovering'' loops | |
1630 | constructed out of lower-level constructs (such as @code{IF} and | |
1631 | @code{GOTO}) can lead to generation of more optimal code | |
1632 | than otherwise.} is done, so only loops written with @code{DO} | |
1633 | benefit from loop optimizations, including---but not limited | |
1634 | to---unrolling. Loops written with @code{IF} and @code{GOTO} are not | |
1635 | currently recognized as such. This option unrolls only iterative | |
1636 | @code{DO} loops, not @code{DO WHILE} loops. | |
1637 | ||
1638 | @cindex -funroll-all-loops option | |
1639 | @cindex options, -funroll-all-loops | |
1640 | @cindex DO WHILE | |
1641 | @item -funroll-all-loops | |
1642 | @c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct. | |
1643 | Probably improves performance on code using @code{DO WHILE} loops by | |
1644 | unrolling them in addition to iterative @code{DO} loops. In the absence | |
1645 | of @code{DO WHILE}, this option is equivalent to @option{-funroll-loops} | |
1646 | but possibly slower. | |
1647 | ||
1648 | @item -fno-move-all-movables | |
1649 | @cindex -fno-move-all-movables option | |
1650 | @cindex options, -fno-move-all-movables | |
1651 | @item -fno-reduce-all-givs | |
1652 | @cindex -fno-reduce-all-givs option | |
1653 | @cindex options, -fno-reduce-all-givs | |
1654 | @item -fno-rerun-loop-opt | |
1655 | @cindex -fno-rerun-loop-opt option | |
1656 | @cindex options, -fno-rerun-loop-opt | |
1657 | In general, the optimizations enabled with these options will lead to | |
1658 | faster code being generated by GNU Fortran; hence they are enabled by default | |
1659 | when issuing the @command{g77} command. | |
1660 | ||
1661 | @option{-fmove-all-movables} and @option{-freduce-all-givs} will enable | |
1662 | loop optimization to move all loop-invariant index computations in nested | |
1663 | loops over multi-rank array dummy arguments out of these loops. | |
1664 | ||
1665 | @option{-frerun-loop-opt} will move offset calculations resulting | |
1666 | from the fact that Fortran arrays by default have a lower bound of 1 | |
1667 | out of the loops. | |
1668 | ||
1669 | These three options are intended to be removed someday, once | |
1670 | loop optimization is sufficiently advanced to perform all those | |
1671 | transformations without help from these options. | |
1672 | @end table | |
1673 | ||
1674 | @xref{Optimize Options,,Options That Control Optimization, | |
1675 | gcc,Using the GNU Compiler Collection (GCC)}, for more information on options | |
1676 | to optimize the generated machine code. | |
1677 | ||
1678 | @node Preprocessor Options | |
1679 | @section Options Controlling the Preprocessor | |
1680 | @cindex preprocessor options | |
1681 | @cindex options, preprocessor | |
1682 | @cindex cpp program | |
1683 | @cindex programs, cpp | |
1684 | ||
1685 | These options control the C preprocessor, which is run on each C source | |
1686 | file before actual compilation. | |
1687 | ||
1688 | @xref{Preprocessor Options,,Options Controlling the Preprocessor, | |
1689 | gcc,Using the GNU Compiler Collection (GCC)}, for information on C | |
1690 | preprocessor options. | |
1691 | ||
1692 | @cindex INCLUDE directive | |
1693 | @cindex directive, INCLUDE | |
1694 | Some of these options also affect how @command{g77} processes the | |
1695 | @code{INCLUDE} directive. | |
1696 | Since this directive is processed even when preprocessing | |
1697 | is not requested, it is not described in this section. | |
1698 | @xref{Directory Options,,Options for Directory Search}, for | |
1699 | information on how @command{g77} processes the @code{INCLUDE} directive. | |
1700 | ||
1701 | However, the @code{INCLUDE} directive does not apply | |
1702 | preprocessing to the contents of the included file itself. | |
1703 | ||
1704 | Therefore, any file that contains preprocessor directives | |
1705 | (such as @code{#include}, @code{#define}, and @code{#if}) | |
1706 | must be included via the @code{#include} directive, not | |
1707 | via the @code{INCLUDE} directive. | |
1708 | Therefore, any file containing preprocessor directives, | |
1709 | if included, is necessarily included by a file that itself | |
1710 | contains preprocessor directives. | |
1711 | ||
1712 | @node Directory Options | |
1713 | @section Options for Directory Search | |
1714 | @cindex directory, options | |
1715 | @cindex options, directory search | |
1716 | @cindex search path | |
1717 | ||
1718 | These options affect how the @command{cpp} preprocessor searches | |
1719 | for files specified via the @code{#include} directive. | |
1720 | Therefore, when compiling Fortran programs, they are meaningful | |
1721 | when the preprocessor is used. | |
1722 | ||
1723 | @cindex INCLUDE directive | |
1724 | @cindex directive, INCLUDE | |
1725 | Some of these options also affect how @command{g77} searches | |
1726 | for files specified via the @code{INCLUDE} directive, | |
1727 | although files included by that directive are not, | |
1728 | themselves, preprocessed. | |
1729 | These options are: | |
1730 | ||
1731 | @table @gcctabopt | |
1732 | @cindex -I- option | |
1733 | @cindex options, -I- | |
1734 | @item -I- | |
1735 | @cindex -Idir option | |
1736 | @cindex options, -Idir | |
1737 | @item -I@var{dir} | |
1738 | @cindex directory, search paths for inclusion | |
1739 | @cindex inclusion, directory search paths for | |
1740 | @cindex search paths, for included files | |
1741 | @cindex paths, search | |
1742 | These affect interpretation of the @code{INCLUDE} directive | |
1743 | (as well as of the @code{#include} directive of the @command{cpp} | |
1744 | preprocessor). | |
1745 | ||
1746 | Note that @option{-I@var{dir}} must be specified @emph{without} any | |
1747 | spaces between @option{-I} and the directory name---that is, | |
1748 | @option{-Ifoo/bar} is valid, but @option{-I foo/bar} | |
1749 | is rejected by the @command{g77} compiler (though the preprocessor supports | |
1750 | the latter form). | |
1751 | @c this is due to toplev.c's inflexible option processing | |
1752 | Also note that the general behavior of @option{-I} and | |
1753 | @code{INCLUDE} is pretty much the same as of @option{-I} with | |
1754 | @code{#include} in the @command{cpp} preprocessor, with regard to | |
1755 | looking for @file{header.gcc} files and other such things. | |
1756 | ||
1757 | @xref{Directory Options,,Options for Directory Search, | |
1758 | gcc,Using the GNU Compiler Collection (GCC)}, for information on the | |
1759 | @option{-I} option. | |
1760 | @end table | |
1761 | ||
1762 | @node Code Gen Options | |
1763 | @section Options for Code Generation Conventions | |
1764 | @cindex code generation, conventions | |
1765 | @cindex options, code generation | |
1766 | @cindex run-time, options | |
1767 | ||
1768 | These machine-independent options control the interface conventions | |
1769 | used in code generation. | |
1770 | ||
1771 | Most of them have both positive and negative forms; the negative form | |
1772 | of @option{-ffoo} would be @option{-fno-foo}. In the table below, only | |
1773 | one of the forms is listed---the one which is not the default. You | |
1774 | can figure out the other form by either removing @option{no-} or adding | |
1775 | it. | |
1776 | ||
1777 | @table @gcctabopt | |
1778 | @cindex -fno-automatic option | |
1779 | @cindex options, -fno-automatic | |
1780 | @item -fno-automatic | |
1781 | @cindex SAVE statement | |
1782 | @cindex statements, SAVE | |
1783 | Treat each program unit as if the @code{SAVE} statement was specified | |
1784 | for every local variable and array referenced in it. | |
1785 | Does not affect common blocks. | |
1786 | (Some Fortran compilers provide this option under | |
1787 | the name @option{-static}.) | |
1788 | ||
1789 | @cindex -finit-local-zero option | |
1790 | @cindex options, -finit-local-zero | |
1791 | @item -finit-local-zero | |
1792 | @cindex DATA statement | |
1793 | @cindex statements, DATA | |
1794 | @cindex initialization, of local variables | |
1795 | @cindex variables, initialization of | |
1796 | @cindex uninitialized variables | |
1797 | @cindex variables, uninitialized | |
1798 | Specify that variables and arrays that are local to a program unit | |
1799 | (not in a common block and not passed as an argument) are to be initialized | |
1800 | to binary zeros. | |
1801 | ||
1802 | Since there is a run-time penalty for initialization of variables | |
1803 | that are not given the @code{SAVE} attribute, it might be a | |
1804 | good idea to also use @option{-fno-automatic} with @option{-finit-local-zero}. | |
1805 | ||
1806 | @cindex -fno-f2c option | |
1807 | @cindex options, -fno-f2c | |
1808 | @item -fno-f2c | |
1809 | @cindex @command{f2c} compatibility | |
1810 | @cindex compatibility, @command{f2c} | |
1811 | Do not generate code designed to be compatible with code generated | |
1812 | by @command{f2c} use the GNU calling conventions instead. | |
1813 | ||
1814 | The @command{f2c} calling conventions require functions that return | |
1815 | type @code{REAL(KIND=1)} to actually return the C type @code{double}, | |
1816 | and functions that return type @code{COMPLEX} to return the | |
1817 | values via an extra argument in the calling sequence that points | |
1818 | to where to store the return value. | |
1819 | Under the GNU calling conventions, such functions simply return | |
1820 | their results as they would in GNU C---@code{REAL(KIND=1)} functions | |
1821 | return the C type @code{float}, and @code{COMPLEX} functions | |
1822 | return the GNU C type @code{complex} (or its @code{struct} | |
1823 | equivalent). | |
1824 | ||
1825 | This does not affect the generation of code that interfaces with the | |
1826 | @code{libg2c} library. | |
1827 | ||
1828 | However, because the @code{libg2c} library uses @command{f2c} | |
1829 | calling conventions, @command{g77} rejects attempts to pass | |
1830 | intrinsics implemented by routines in this library as actual | |
1831 | arguments when @option{-fno-f2c} is used, to avoid bugs when | |
1832 | they are actually called by code expecting the GNU calling | |
1833 | conventions to work. | |
1834 | ||
1835 | For example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is | |
1836 | rejected when @option{-fno-f2c} is in force. | |
1837 | (Future versions of the @command{g77} run-time library might | |
1838 | offer routines that provide GNU-callable versions of the | |
1839 | routines that implement the @command{f2c} intrinsics | |
1840 | that may be passed as actual arguments, so that | |
1841 | valid programs need not be rejected when @option{-fno-f2c} | |
1842 | is used.) | |
1843 | ||
1844 | @strong{Caution:} If @option{-fno-f2c} is used when compiling any | |
1845 | source file used in a program, it must be used when compiling | |
1846 | @emph{all} Fortran source files used in that program. | |
1847 | ||
1848 | @c seems kinda dumb to tell people about an option they can't use -- jcb | |
1849 | @c then again, we want users building future-compatible libraries with it. | |
1850 | @cindex -ff2c-library option | |
1851 | @cindex options, -ff2c-library | |
1852 | @item -ff2c-library | |
1853 | Specify that use of @code{libg2c} (or the original @code{libf2c}) | |
1854 | is required. | |
1855 | This is the default for the current version of @command{g77} | |
1856 | ||
1857 | Currently it is not | |
1858 | valid to specify @option{-fno-f2c-library}. | |
1859 | This option is provided so users can specify it in shell | |
1860 | scripts that build programs and libraries that require the | |
1861 | @code{libf2c} library, even when being compiled by future | |
1862 | versions of @command{g77} that might otherwise default to | |
1863 | generating code for an incompatible library. | |
1864 | ||
1865 | @cindex -fno-underscoring option | |
1866 | @cindex options, -fno-underscoring | |
1867 | @item -fno-underscoring | |
1868 | @cindex underscore | |
1869 | @cindex symbol names, underscores | |
1870 | @cindex transforming symbol names | |
1871 | @cindex symbol names, transforming | |
1872 | Do not transform names of entities specified in the Fortran | |
1873 | source file by appending underscores to them. | |
1874 | ||
1875 | With @option{-funderscoring} in effect, @command{g77} appends two underscores | |
1876 | to names with underscores and one underscore to external names with | |
1877 | no underscores. (@command{g77} also appends two underscores to internal | |
1878 | names with underscores to avoid naming collisions with external names. | |
1879 | The @option{-fno-second-underscore} option disables appending of the | |
1880 | second underscore in all cases.) | |
1881 | ||
1882 | This is done to ensure compatibility with code produced by many | |
1883 | UNIX Fortran compilers, including @command{f2c} which perform the | |
1884 | same transformations. | |
1885 | ||
1886 | Use of @option{-fno-underscoring} is not recommended unless you are | |
1887 | experimenting with issues such as integration of (GNU) Fortran into | |
1888 | existing system environments (vis-a-vis existing libraries, tools, and | |
1889 | so on). | |
1890 | ||
1891 | For example, with @option{-funderscoring}, and assuming other defaults like | |
1892 | @option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are | |
1893 | external functions while @samp{my_var} and @samp{lvar} are local variables, | |
1894 | a statement like | |
1895 | ||
1896 | @smallexample | |
1897 | I = J() + MAX_COUNT (MY_VAR, LVAR) | |
1898 | @end smallexample | |
1899 | ||
1900 | @noindent | |
1901 | is implemented as something akin to: | |
1902 | ||
1903 | @smallexample | |
1904 | i = j_() + max_count__(&my_var__, &lvar); | |
1905 | @end smallexample | |
1906 | ||
1907 | With @option{-fno-underscoring}, the same statement is implemented as: | |
1908 | ||
1909 | @smallexample | |
1910 | i = j() + max_count(&my_var, &lvar); | |
1911 | @end smallexample | |
1912 | ||
1913 | Use of @option{-fno-underscoring} allows direct specification of | |
1914 | user-defined names while debugging and when interfacing @command{g77} | |
1915 | code with other languages. | |
1916 | ||
1917 | Note that just because the names match does @emph{not} mean that the | |
1918 | interface implemented by @command{g77} for an external name matches the | |
1919 | interface implemented by some other language for that same name. | |
1920 | That is, getting code produced by @command{g77} to link to code produced | |
1921 | by some other compiler using this or any other method can be only a | |
1922 | small part of the overall solution---getting the code generated by | |
1923 | both compilers to agree on issues other than naming can require | |
1924 | significant effort, and, unlike naming disagreements, linkers normally | |
1925 | cannot detect disagreements in these other areas. | |
1926 | ||
1927 | Also, note that with @option{-fno-underscoring}, the lack of appended | |
1928 | underscores introduces the very real possibility that a user-defined | |
1929 | external name will conflict with a name in a system library, which | |
1930 | could make finding unresolved-reference bugs quite difficult in some | |
1931 | cases---they might occur at program run time, and show up only as | |
1932 | buggy behavior at run time. | |
1933 | ||
1934 | In future versions of @command{g77} we hope to improve naming and linking | |
1935 | issues so that debugging always involves using the names as they appear | |
1936 | in the source, even if the names as seen by the linker are mangled to | |
1937 | prevent accidental linking between procedures with incompatible | |
1938 | interfaces. | |
1939 | ||
1940 | @cindex -fno-second-underscore option | |
1941 | @cindex options, -fno-second-underscore | |
1942 | @item -fno-second-underscore | |
1943 | @cindex underscore | |
1944 | @cindex symbol names, underscores | |
1945 | @cindex transforming symbol names | |
1946 | @cindex symbol names, transforming | |
1947 | Do not append a second underscore to names of entities specified | |
1948 | in the Fortran source file. | |
1949 | ||
1950 | This option has no effect if @option{-fno-underscoring} is | |
1951 | in effect. | |
1952 | ||
1953 | Otherwise, with this option, an external name such as @samp{MAX_COUNT} | |
1954 | is implemented as a reference to the link-time external symbol | |
1955 | @samp{max_count_}, instead of @samp{max_count__}. | |
1956 | ||
1957 | @cindex -fno-ident option | |
1958 | @cindex options, -fno-ident | |
1959 | @item -fno-ident | |
1960 | Ignore the @samp{#ident} directive. | |
1961 | ||
1962 | @cindex -fzeros option | |
1963 | @cindex options, -fzeros | |
1964 | @item -fzeros | |
1965 | Treat initial values of zero as if they were any other value. | |
1966 | ||
1967 | As of version 0.5.18, @command{g77} normally treats @code{DATA} and | |
1968 | other statements that are used to specify initial values of zero | |
1969 | for variables and arrays as if no values were actually specified, | |
1970 | in the sense that no diagnostics regarding multiple initializations | |
1971 | are produced. | |
1972 | ||
1973 | This is done to speed up compiling of programs that initialize | |
1974 | large arrays to zeros. | |
1975 | ||
1976 | Use @option{-fzeros} to revert to the simpler, slower behavior | |
1977 | that can catch multiple initializations by keeping track of | |
1978 | all initializations, zero or otherwise. | |
1979 | ||
1980 | @emph{Caution:} Future versions of @command{g77} might disregard this option | |
1981 | (and its negative form, the default) or interpret it somewhat | |
1982 | differently. | |
1983 | The interpretation changes will affect only non-standard | |
1984 | programs; standard-conforming programs should not be affected. | |
1985 | ||
1986 | @cindex -femulate-complex option | |
1987 | @cindex options, -femulate-complex | |
1988 | @item -femulate-complex | |
1989 | Implement @code{COMPLEX} arithmetic via emulation, | |
1990 | instead of using the facilities of | |
1991 | the @command{gcc} back end that provide direct support of | |
1992 | @code{complex} arithmetic. | |
1993 | ||
1994 | (@command{gcc} had some bugs in its back-end support | |
1995 | for @code{complex} arithmetic, due primarily to the support not being | |
1996 | completed as of version 2.8.1 and @code{egcs} 1.1.2.) | |
1997 | ||
1998 | Use @option{-femulate-complex} if you suspect code-generation bugs, | |
1999 | or experience compiler crashes, | |
2000 | that might result from @command{g77} using the @code{COMPLEX} support | |
2001 | in the @command{gcc} back end. | |
2002 | If using that option fixes the bugs or crashes you are seeing, | |
2003 | that indicates a likely @command{g77} bugs | |
2004 | (though, all compiler crashes are considered bugs), | |
2005 | so, please report it. | |
2006 | (Note that the known bugs, now believed fixed, produced compiler crashes | |
2007 | rather than causing the generation of incorrect code.) | |
2008 | ||
2009 | Use of this option should not affect how Fortran code compiled | |
2010 | by @command{g77} works in terms of its interfaces to other code, | |
2011 | e.g. that compiled by @command{f2c} | |
2012 | ||
2013 | As of GCC version 3.0, this option is not necessary anymore. | |
2014 | ||
2015 | @emph{Caution:} Future versions of @command{g77} might ignore both forms | |
2016 | of this option. | |
2017 | ||
2018 | @cindex -falias-check option | |
2019 | @cindex options, -falias-check | |
2020 | @cindex -fargument-alias option | |
2021 | @cindex options, -fargument-alias | |
2022 | @cindex -fargument-noalias option | |
2023 | @cindex options, -fargument-noalias | |
2024 | @cindex -fno-argument-noalias-global option | |
2025 | @cindex options, -fno-argument-noalias-global | |
2026 | @item -falias-check | |
2027 | @item -fargument-alias | |
2028 | @item -fargument-noalias | |
2029 | @item -fno-argument-noalias-global | |
2030 | @emph{Version info:} | |
2031 | These options are not supported by | |
2032 | versions of @command{g77} based on @command{gcc} version 2.8. | |
2033 | ||
2034 | These options specify to what degree aliasing | |
2035 | (overlap) | |
2036 | is permitted between | |
2037 | arguments (passed as pointers) and @code{COMMON} (external, or | |
2038 | public) storage. | |
2039 | ||
2040 | The default for Fortran code, as mandated by the FORTRAN 77 and | |
2041 | Fortran 90 standards, is @option{-fargument-noalias-global}. | |
2042 | The default for code written in the C language family is | |
2043 | @option{-fargument-alias}. | |
2044 | ||
2045 | Note that, on some systems, compiling with @option{-fforce-addr} in | |
2046 | effect can produce more optimal code when the default aliasing | |
2047 | options are in effect (and when optimization is enabled). | |
2048 | ||
2049 | @xref{Aliasing Assumed To Work}, for detailed information on the implications | |
2050 | of compiling Fortran code that depends on the ability to alias dummy | |
2051 | arguments. | |
2052 | ||
2053 | @cindex -fno-globals option | |
2054 | @cindex options, -fno-globals | |
2055 | @item -fno-globals | |
2056 | @cindex global names, warning | |
2057 | @cindex warnings, global names | |
2058 | @cindex in-line code | |
2059 | @cindex compilation, in-line | |
2060 | Disable diagnostics about inter-procedural | |
2061 | analysis problems, such as disagreements about the | |
2062 | type of a function or a procedure's argument, | |
2063 | that might cause a compiler crash when attempting | |
2064 | to inline a reference to a procedure within a | |
2065 | program unit. | |
2066 | (The diagnostics themselves are still produced, but | |
2067 | as warnings, unless @option{-Wno-globals} is specified, | |
2068 | in which case no relevant diagnostics are produced.) | |
2069 | ||
2070 | Further, this option disables such inlining, to | |
2071 | avoid compiler crashes resulting from incorrect | |
2072 | code that would otherwise be diagnosed. | |
2073 | ||
2074 | As such, this option might be quite useful when | |
2075 | compiling existing, ``working'' code that happens | |
2076 | to have a few bugs that do not generally show themselves, | |
2077 | but which @command{g77} diagnoses. | |
2078 | ||
2079 | Use of this option therefore has the effect of | |
2080 | instructing @command{g77} to behave more like it did | |
2081 | up through version 0.5.19.1, when it paid little or | |
2082 | no attention to disagreements between program units | |
2083 | about a procedure's type and argument information, | |
2084 | and when it performed no inlining of procedures | |
2085 | (except statement functions). | |
2086 | ||
2087 | Without this option, @command{g77} defaults to performing | |
2088 | the potentially inlining procedures as it started doing | |
2089 | in version 0.5.20, but as of version 0.5.21, it also | |
2090 | diagnoses disagreements that might cause such inlining | |
2091 | to crash the compiler as (fatal) errors, | |
2092 | and warns about similar disagreements | |
2093 | that are currently believed to not | |
2094 | likely to result in the compiler later crashing | |
2095 | or producing incorrect code. | |
2096 | ||
2097 | @cindex -fflatten-arrays option | |
2098 | @item -fflatten-arrays | |
2099 | @cindex array performance | |
2100 | @cindex arrays, flattening | |
2101 | Use back end's C-like constructs | |
2102 | (pointer plus offset) | |
2103 | instead of its @code{ARRAY_REF} construct | |
2104 | to handle all array references. | |
2105 | ||
2106 | @emph{Note:} This option is not supported. | |
2107 | It is intended for use only by @command{g77} developers, | |
2108 | to evaluate code-generation issues. | |
2109 | It might be removed at any time. | |
2110 | ||
2111 | @cindex -fbounds-check option | |
2112 | @cindex -ffortran-bounds-check option | |
2113 | @item -fbounds-check | |
2114 | @itemx -ffortran-bounds-check | |
2115 | @cindex bounds checking | |
2116 | @cindex range checking | |
2117 | @cindex array bounds checking | |
2118 | @cindex subscript checking | |
2119 | @cindex substring checking | |
2120 | @cindex checking subscripts | |
2121 | @cindex checking substrings | |
2122 | Enable generation of run-time checks for array subscripts | |
2123 | and substring start and end points | |
2124 | against the (locally) declared minimum and maximum values. | |
2125 | ||
2126 | The current implementation uses the @code{libf2c} | |
2127 | library routine @code{s_rnge} to print the diagnostic. | |
2128 | ||
2129 | However, whereas @command{f2c} generates a single check per | |
2130 | reference for a multi-dimensional array, of the computed | |
2131 | offset against the valid offset range (0 through the size of the array), | |
2132 | @command{g77} generates a single check per @emph{subscript} expression. | |
2133 | This catches some cases of potential bugs that @command{f2c} does not, | |
2134 | such as references to below the beginning of an assumed-size array. | |
2135 | ||
2136 | @command{g77} also generates checks for @code{CHARACTER} substring references, | |
2137 | something @command{f2c} currently does not do. | |
2138 | ||
2139 | Use the new @option{-ffortran-bounds-check} option | |
2140 | to specify bounds-checking for only the Fortran code you are compiling, | |
2141 | not necessarily for code written in other languages. | |
2142 | ||
2143 | @emph{Note:} To provide more detailed information on the offending subscript, | |
2144 | @command{g77} provides the @code{libg2c} run-time library routine @code{s_rnge} | |
2145 | with somewhat differently-formatted information. | |
2146 | Here's a sample diagnostic: | |
2147 | ||
2148 | @smallexample | |
2149 | Subscript out of range on file line 4, procedure rnge.f/bf. | |
2150 | Attempt to access the -6-th element of variable b[subscript-2-of-2]. | |
2151 | Aborted | |
2152 | @end smallexample | |
2153 | ||
2154 | The above message indicates that the offending source line is | |
2155 | line 4 of the file @file{rnge.f}, | |
2156 | within the program unit (or statement function) named @samp{bf}. | |
2157 | The offended array is named @samp{b}. | |
2158 | The offended array dimension is the second for a two-dimensional array, | |
2159 | and the offending, computed subscript expression was @samp{-6}. | |
2160 | ||
2161 | For a @code{CHARACTER} substring reference, the second line has | |
2162 | this appearance: | |
2163 | ||
2164 | @smallexample | |
2165 | Attempt to access the 11-th element of variable a[start-substring]. | |
2166 | @end smallexample | |
2167 | ||
2168 | This indicates that the offended @code{CHARACTER} variable or array | |
2169 | is named @samp{a}, | |
2170 | the offended substring position is the starting (leftmost) position, | |
2171 | and the offending substring expression is @samp{11}. | |
2172 | ||
2173 | (Though the verbage of @code{s_rnge} is not ideal | |
2174 | for the purpose of the @command{g77} compiler, | |
2175 | the above information should provide adequate diagnostic abilities | |
2176 | to it users.) | |
2177 | @end table | |
2178 | ||
2179 | @xref{Code Gen Options,,Options for Code Generation Conventions, | |
2180 | gcc,Using the GNU Compiler Collection (GCC)}, for information on more options | |
2181 | offered by the GBE | |
2182 | shared by @command{g77} @command{gcc} and other GNU compilers. | |
2183 | ||
2184 | Some of these do @emph{not} work when compiling programs written in Fortran: | |
2185 | ||
2186 | @table @gcctabopt | |
2187 | @cindex -fpcc-struct-return option | |
2188 | @cindex options, -fpcc-struct-return | |
2189 | @item -fpcc-struct-return | |
2190 | @cindex -freg-struct-return option | |
2191 | @cindex options, -freg-struct-return | |
2192 | @item -freg-struct-return | |
2193 | You should not use these except strictly the same way as you | |
2194 | used them to build the version of @code{libg2c} with which | |
2195 | you will be linking all code compiled by @command{g77} with the | |
2196 | same option. | |
2197 | ||
2198 | @cindex -fshort-double option | |
2199 | @cindex options, -fshort-double | |
2200 | @item -fshort-double | |
2201 | This probably either has no effect on Fortran programs, or | |
2202 | makes them act loopy. | |
2203 | ||
2204 | @cindex -fno-common option | |
2205 | @cindex options, -fno-common | |
2206 | @item -fno-common | |
2207 | Do not use this when compiling Fortran programs, | |
2208 | or there will be Trouble. | |
2209 | ||
2210 | @cindex -fpack-struct option | |
2211 | @cindex options, -fpack-struct | |
2212 | @item -fpack-struct | |
2213 | This probably will break any calls to the @code{libg2c} library, | |
2214 | at the very least, even if it is built with the same option. | |
2215 | @end table | |
2216 | ||
2217 | @c man end | |
2218 | ||
2219 | @node Environment Variables | |
2220 | @section Environment Variables Affecting GNU Fortran | |
2221 | @cindex environment variables | |
2222 | ||
2223 | @c man begin ENVIRONMENT | |
2224 | ||
2225 | GNU Fortran currently does not make use of any environment | |
2226 | variables to control its operation above and beyond those | |
2227 | that affect the operation of @command{gcc}. | |
2228 | ||
2229 | @xref{Environment Variables,,Environment Variables Affecting GCC, | |
2230 | gcc,Using the GNU Compiler Collection (GCC)}, for information on environment | |
2231 | variables. | |
2232 | ||
2233 | @c man end |