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