OSDN Git Service

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