aboutsummaryrefslogtreecommitdiff
path: root/gcc/f/g77.info-2
blob: 191b4c8d0e8ce7b376206adea96433ef559cbcad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
This is Info file g77.info, produced by Makeinfo version 1.68 from the
input file g77.texi.

   This file explains how to use the GNU Fortran system.

   Published by the Free Software Foundation 59 Temple Place - Suite 330
Boston, MA 02111-1307 USA

   Copyright (C) 1995-1997 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License," "Funding for
Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License," "Funding for Free Software," and "Protect Your Freedom--Fight
`Look And Feel'", and this permission notice, may be included in
translations approved by the Free Software Foundation instead of in the
original English.

   Contributed by James Craig Burley (<burley@gnu.ai.mit.edu>).
Inspired by a first pass at translating `g77-0.5.16/f/DOC' that was
contributed to Craig by David Ronis (<ronis@onsager.chem.mcgill.ca>).

INFO-DIR-SECTION Fortran Programming
START-INFO-DIR-ENTRY
* g77: (g77).               The GNU Fortran compilation system.
END-INFO-DIR-ENTRY


File: g77.info,  Node: Overall Options,  Next: Shorthand Options,  Prev: Option Summary,  Up: Invoking G77

Options Controlling the Kind of Output
======================================

   Compilation can involve as many as four stages: preprocessing, code
generation (often what is really meant by the term "compilation"),
assembly, and linking, always in that order.  The first three stages
apply to an individual source file, and end by producing an object
file; linking combines all the object files (those newly compiled, and
those specified as input) into an executable file.

   For any given input file, the file name suffix determines what kind
of program is contained in the file--that is, the language in which the
program is written is generally indicated by the suffix.  Suffixes
specific to GNU Fortran are listed below.  *Note gcc: (Using and
Porting GNU CC)Overall Options, for information on suffixes recognized
by GNU CC.

`FILE.f'

`FILE.for'
     Fortran source code that should not be preprocessed.

     Such source code cannot contain any preprocessor directives, such
     as `#include', `#define', `#if', and so on.

`FILE.F'

`FILE.fpp'
     Fortran source code that must be preprocessed (by the C
     preprocessor `cpp', which is part of GNU CC).

     Note that preprocessing is not extended to the contents of files
     included by the `INCLUDE' directive--the `#include' preprocessor
     directive must be used instead.

`FILE.r'
     Ratfor source code, which must be preprocessed by the `ratfor'
     command, which is available separately (as it is not yet part of
     the GNU Fortran distribution).

   UNIX users typically use the `FILE.f' and `FILE.F' nomenclature.
Users of other operating systems, especially those that cannot
distinguish upper-case letters from lower-case letters in their file
names, typically use the `FILE.for' and `FILE.fpp' nomenclature.

   Use of the preprocessor `cpp' allows use of C-like constructs such
as `#define' and `#include', but can lead to unexpected, even mistaken,
results due to Fortran's source file format.  It is recommended that
use of the C preprocessor be limited to `#include' and, in conjunction
with `#define', only `#if' and related directives, thus avoiding
in-line macro expansion entirely.  This recommendation applies
especially when using the traditional fixed source form.  With free
source form, fewer unexpected transformations are likely to happen, but
use of constructs such as Hollerith and character constants can
nevertheless present problems, especially when these are continued
across multiple source lines.  These problems result, primarily, from
differences between the way such constants are interpreted by the C
preprocessor and by a Fortran compiler.

   Another example of a problem that results from using the C
preprocessor is that a Fortran comment line that happens to contain any
characters "interesting" to the C preprocessor, such as a backslash at
the end of the line, is not recognized by the preprocessor as a comment
line, so instead of being passed through "raw", the line is edited
according to the rules for the preprocessor.  For example, the
backslash at the end of the line is removed, along with the subsequent
newline, resulting in the next line being effectively commented
out--unfortunate if that line is a non-comment line of important code!

   *Note:* The `-traditional' and `-undef' flags are supplied to `cpp'
by default, to avoid unpleasant surprises.  *Note Options Controlling
the Preprocessor: (gcc)Preprocessor Options.  This means that ANSI C
preprocessor features (such as the `#' operator) aren't available, and
only variables in the C reserved namespace (generally, names with a
leading underscore) are liable to substitution by C predefines.  Thus,
if you want to do system-specific tests, use, for example, `#ifdef
__linux__' rather than `#ifdef linux'.  Use the `-v' option to see
exactly how the preprocessor is invoked.

   The following options that affect overall processing are recognized
by the `g77' and `gcc' commands in a GNU Fortran installation:

`--driver=COMMAND'
     This works when invoking only the `g77' command, not when invoking
     the `gcc' command.  *Note GNU Fortran Command Options: Invoking
     G77, for information on this option.

`-fversion'
     Ensure that the `g77'-specific version of the compiler phase is
     reported, if run.  (This is supplied automatically when `-v' or
     `--verbose' is specified as a command-line option for `g77' or
     `gcc' and when the resulting commands compile Fortran source
     files.)

`-fset-g77-defaults'
     Set up whatever `gcc' options are to apply to Fortran
     compilations, and avoid running internal consistency checks that
     might take some time.

     As of version 0.5.20, this is equivalent to `-fmove-all-movables
     -freduce-all-givs -frerun-loop-opt -fargument-noalias-global'.

     This option is supplied automatically when compiling Fortran code
     via the `g77' or `gcc' command.  The description of this option is
     provided so that users seeing it in the output of, say, `g77 -v'
     understand why it is there.

     Also, developers who run `f771' directly might want to specify it
     by hand to get the same defaults as they would running `f771' via
     `g77' or `gcc'.  However, such developers should, after linking a
     new `f771' executable, invoke it without this option once, e.g.
     via `./f771 -quiet < /dev/null', to ensure that they have not
     introduced any internal inconsistencies (such as in the table of
     intrinsics) before proceeding--`g77' will crash with a diagnostic
     if it detects an inconsistency.

`-fno-silent'
     Print (to `stderr') the names of the program units as they are
     compiled, in a form similar to that used by popular UNIX `f77'
     implementations and `f2c'.

   *Note Options Controlling the Kind of Output: (gcc)Overall Options,
for information on more options that control the overall operation of
the `gcc' command (and, by extension, the `g77' command).


File: g77.info,  Node: Shorthand Options,  Next: Fortran Dialect Options,  Prev: Overall Options,  Up: Invoking G77

Shorthand Options
=================

   The following options serve as "shorthand" for other options
accepted by the compiler:

`-fugly'
     Specify that certain "ugly" constructs are to be quietly accepted.
     Same as:

          -fugly-args -fugly-assign -fugly-assumed
          -fugly-comma -fugly-complex -fugly-init
          -fugly-logint

     These constructs are considered inappropriate to use in new or
     well-maintained portable Fortran code, but widely used in old code.
     *Note Distensions::, for more information.

     *Note:* The `-fugly' option is likely to be removed in a future
     version.  Implicitly enabling all the `-fugly-*' options is
     unlikely to be feasible, or sensible, in the future, so users
     should learn to specify only those `-fugly-*' options they really
     need for a particular source file.

`-fno-ugly'
     Specify that all "ugly" constructs are to be noisily rejected.
     Same as:

          -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed
          -fno-ugly-comma -fno-ugly-complex -fno-ugly-init
          -fno-ugly-logint

     *Note Distensions::, for more information.

`-ff66'
     Specify that the program is written in idiomatic FORTRAN 66.  Same
     as `-fonetrip -fugly-assumed'.

     The `-fno-f66' option is the inverse of `-ff66'.  As such, it is
     the same as `-fno-onetrip -fno-ugly-assumed'.

     The meaning of this option is likely to be refined as future
     versions of `g77' provide more compatibility with other existing
     and obsolete Fortran implementations.

`-ff77'
     Specify that the program is written in idiomatic UNIX FORTRAN 77
     and/or the dialect accepted by the `f2c' product.  Same as
     `-fbackslash -fno-typeless-boz'.

     The meaning of this option is likely to be refined as future
     versions of `g77' provide more compatibility with other existing
     and obsolete Fortran implementations.

`-fno-f77'
     The `-fno-f77' option is *not* the inverse of `-ff77'.  It
     specifies that the program is not written in idiomatic UNIX
     FORTRAN 77 or `f2c', but in a more widely portable dialect.
     `-fno-f77' is the same as `-fno-backslash'.

     The meaning of this option is likely to be refined as future
     versions of `g77' provide more compatibility with other existing
     and obsolete Fortran implementations.


File: g77.info,  Node: Fortran Dialect Options,  Next: Warning Options,  Prev: Shorthand Options,  Up: Invoking G77

Options Controlling Fortran Dialect
===================================

   The following options control the dialect of Fortran that the
compiler accepts:

`-ffree-form'

`-fno-fixed-form'
     Specify that the source file is written in free form (introduced
     in Fortran 90) instead of the more-traditional fixed form.

`-ff90'
     Allow certain Fortran-90 constructs.

     This option controls whether certain Fortran 90 constructs are
     recognized.  (Other Fortran 90 constructs might or might not be
     recognized depending on other options such as `-fvxt',
     `-ff90-intrinsics-enable', and the current level of support for
     Fortran 90.)

     *Note Fortran 90::, for more information.

`-fvxt'
     Specify the treatment of certain constructs that have different
     meanings depending on whether the code is written in GNU Fortran
     (based on FORTRAN 77 and akin to Fortran 90) or VXT Fortran (more
     like VAX FORTRAN).

     The default is `-fno-vxt'.  `-fvxt' specifies that the VXT Fortran
     interpretations for those constructs are to be chosen.

     *Note VXT Fortran::, for more information.

`-fdollar-ok'
     Allow `$' as a valid character in a symbol name.

`-fno-backslash'
     Specify that `\' is not to be specially interpreted in character
     and Hollerith constants a la C and many UNIX Fortran compilers.

     For example, with `-fbackslash' in effect, `A\nB' specifies three
     characters, with the second one being newline.  With
     `-fno-backslash', it specifies four characters, `A', `\', `n', and
     `B'.

     Note that `g77' implements a fairly general form of backslash
     processing that is incompatible with the narrower forms supported
     by some other compilers.  For example, `'A\003B'' is a
     three-character string in `g77', whereas other compilers that
     support backslash might not support the three-octal-digit form,
     and thus treat that string as longer than three characters.

     *Note Backslash in Constants::, for information on why
     `-fbackslash' is the default instead of `-fno-backslash'.

`-fno-ugly-args'
     Disallow passing Hollerith and typeless constants as actual
     arguments (for example, `CALL FOO(4HABCD)').

     *Note Ugly Implicit Argument Conversion::, for more information.

`-fugly-assign'
     Use the same storage for a given variable regardless of whether it
     is used to hold an assigned-statement label (as in `ASSIGN 10 TO
     I') or used to hold numeric data (as in `I = 3').

     *Note Ugly Assigned Labels::, for more information.

`-fugly-assumed'
     Assume any dummy array with a final dimension specified as `1' is
     really an assumed-size array, as if `*' had been specified for the
     final dimension instead of `1'.

     For example, `DIMENSION X(1)' is treated as if it had read
     `DIMENSION X(*)'.

     *Note Ugly Assumed-Size Arrays::, for more information.

`-fugly-comma'
     Treat a trailing comma in an argument list as specification of a
     trailing null argument, and treat an empty argument list as
     specification of a single null argument.

     For example, `CALL FOO(,)' is treated as `CALL FOO(%VAL(0),
     %VAL(0))'.  That is, *two* null arguments are specified by the
     procedure call when `-fugly-comma' is in force.  And `F = FUNC()'
     is treated as `F = FUNC(%VAL(0))'.

     The default behavior, `-fno-ugly-comma', is to ignore a single
     trailing comma in an argument list.

     *Note Ugly Null Arguments::, for more information.

`-fugly-complex'
     Do not complain about `REAL(EXPR)' or `AIMAG(EXPR)' when EXPR is a
     `COMPLEX' type other than `COMPLEX(KIND=1)'--usually this is used
     to permit `COMPLEX(KIND=2)' (`DOUBLE COMPLEX') operands.

     The `-ff90' option controls the interpretation of this construct.

     *Note Ugly Complex Part Extraction::, for more information.

`-fno-ugly-init'
     Disallow use of Hollerith and typeless constants as initial values
     (in `PARAMETER' and `DATA' statements), and use of character
     constants to initialize numeric types and vice versa.

     For example, `DATA I/'F'/, CHRVAR/65/, J/4HABCD/' is disallowed by
     `-fno-ugly-init'.

     *Note Ugly Conversion of Initializers::, for more information.

`-fugly-logint'
     Treat `INTEGER' and `LOGICAL' variables and expressions as
     potential stand-ins for each other.

     For example, automatic conversion between `INTEGER' and `LOGICAL'
     is enabled, for many contexts, via this option.

     *Note Ugly Integer Conversions::, for more information.

`-fonetrip'
     Imperative executable `DO' loops are to be executed at least once
     each time they are reached.

     ANSI FORTRAN 77 and more recent versions of the Fortran standard
     specify that the body of an imperative `DO' loop is not executed
     if the number of iterations calculated from the parameters of the
     loop is less than 1.  (For example, `DO 10 I = 1, 0'.)  Such a
     loop is called a "zero-trip loop".

     Prior to ANSI FORTRAN 77, many compilers implemented `DO' loops
     such that the body of a loop would be executed at least once, even
     if the iteration count was zero.  Fortran code written assuming
     this behavior is said to require "one-trip loops".  For example,
     some code written to the FORTRAN 66 standard expects this behavior
     from its `DO' loops, although that standard did not specify this
     behavior.

     The `-fonetrip' option specifies that the source file(s) being
     compiled require one-trip loops.

     This option affects only those loops specified by the (imperative)
     `DO' statement and by implied-`DO' lists in I/O statements.  Loops
     specified by implied-`DO' lists in `DATA' and specification
     (non-executable) statements are not affected.

`-ftypeless-boz'
     Specifies that prefix-radix non-decimal constants, such as
     `Z'ABCD'', are typeless instead of `INTEGER(KIND=1)'.

     You can test for yourself whether a particular compiler treats the
     prefix form as `INTEGER(KIND=1)' or typeless by running the
     following program:

          EQUIVALENCE (I, R)
          R = Z'ABCD1234'
          J = Z'ABCD1234'
          IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS'
          IF (J .NE. I) PRINT *, 'Prefix form is INTEGER'
          END

     Reports indicate that many compilers process this form as
     `INTEGER(KIND=1)', though a few as typeless, and at least one
     based on a command-line option specifying some kind of
     compatibility.

`-fintrin-case-initcap'

`-fintrin-case-upper'

`-fintrin-case-lower'

`-fintrin-case-any'
     Specify expected case for intrinsic names.  `-fintrin-case-lower'
     is the default.

`-fmatch-case-initcap'

`-fmatch-case-upper'

`-fmatch-case-lower'

`-fmatch-case-any'
     Specify expected case for keywords.  `-fmatch-case-lower' is the
     default.

`-fsource-case-upper'

`-fsource-case-lower'

`-fsource-case-preserve'
     Specify whether source text other than character and Hollerith
     constants is to be translated to uppercase, to lowercase, or
     preserved as is.  `-fsource-case-lower' is the default.

`-fsymbol-case-initcap'

`-fsymbol-case-upper'

`-fsymbol-case-lower'

`-fsymbol-case-any'
     Specify valid cases for user-defined symbol names.
     `-fsymbol-case-any' is the default.

`-fcase-strict-upper'
     Same as `-fintrin-case-upper -fmatch-case-upper
     -fsource-case-preserve -fsymbol-case-upper'.  (Requires all
     pertinent source to be in uppercase.)

`-fcase-strict-lower'
     Same as `-fintrin-case-lower -fmatch-case-lower
     -fsource-case-preserve -fsymbol-case-lower'.  (Requires all
     pertinent source to be in lowercase.)

`-fcase-initcap'
     Same as `-fintrin-case-initcap -fmatch-case-initcap
     -fsource-case-preserve -fsymbol-case-initcap'.  (Requires all
     pertinent source to be in initial capitals, as in `Print
     *,SqRt(Value)'.)

`-fcase-upper'
     Same as `-fintrin-case-any -fmatch-case-any -fsource-case-upper
     -fsymbol-case-any'.  (Maps all pertinent source to uppercase.)

`-fcase-lower'
     Same as `-fintrin-case-any -fmatch-case-any -fsource-case-lower
     -fsymbol-case-any'.  (Maps all pertinent source to lowercase.)

`-fcase-preserve'
     Same as `-fintrin-case-any -fmatch-case-any -fsource-case-preserve
     -fsymbol-case-any'.  (Preserves all case in user-defined symbols,
     while allowing any-case matching of intrinsics and keywords.  For
     example, `call Foo(i,I)' would pass two *different* variables
     named `i' and `I' to a procedure named `Foo'.)

`-ff2c-intrinsics-delete'

`-ff2c-intrinsics-hide'

`-ff2c-intrinsics-disable'

`-ff2c-intrinsics-enable'
     Specify status of f2c-specific intrinsics.
     `-ff2c-intrinsics-enable' is the default.

`-ff90-intrinsics-delete'

`-ff90-intrinsics-hide'

`-ff90-intrinsics-disable'

`-ff90-intrinsics-enable'
     Specify status of F90-specific intrinsics.
     `-ff90-intrinsics-enable' is the default.

`-fgnu-intrinsics-delete'

`-fgnu-intrinsics-hide'

`-fgnu-intrinsics-disable'

`-fgnu-intrinsics-enable'
     Specify status of Digital's COMPLEX-related intrinsics.
     `-fgnu-intrinsics-enable' is the default.

`-fmil-intrinsics-delete'

`-fmil-intrinsics-hide'

`-fmil-intrinsics-disable'

`-fmil-intrinsics-enable'
     Specify status of MIL-STD-1753-specific intrinsics.
     `-fmil-intrinsics-enable' is the default.

`-funix-intrinsics-delete'

`-funix-intrinsics-hide'

`-funix-intrinsics-disable'

`-funix-intrinsics-enable'
     Specify status of UNIX intrinsics.  `-funix-intrinsics-enable' is
     the default.

`-fvxt-intrinsics-delete'

`-fvxt-intrinsics-hide'

`-fvxt-intrinsics-disable'

`-fvxt-intrinsics-enable'
     Specify status of VXT intrinsics.  `-fvxt-intrinsics-enable' is
     the default.

`-ffixed-line-length-N'
     Set column after which characters are ignored in typical fixed-form
     lines in the source file, and through which spaces are assumed (as
     if padded to that length) after the ends of short fixed-form lines.

     Popular values for N include 72 (the standard and the default), 80
     (card image), and 132 (corresponds to "extended-source" options in
     some popular compilers).  N may be `none', meaning that the entire
     line is meaningful and that continued character constants never
     have implicit spaces appended to them to fill out the line.
     `-ffixed-line-length-0' means the same thing as
     `-ffixed-line-length-none'.

     *Note Source Form::, for more information.


File: g77.info,  Node: Warning Options,  Next: Debugging Options,  Prev: Fortran Dialect Options,  Up: Invoking G77

Options to Request or Suppress Warnings
=======================================

   Warnings are diagnostic messages that report constructions which are
not inherently erroneous but which are risky or suggest there might
have been an error.

   You can request many specific warnings with options beginning `-W',
for example `-Wimplicit' to request warnings on implicit declarations.
Each of these specific warning options also has a negative form
beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
This manual lists only one of the two forms, whichever is not the
default.

   These options control the amount and kinds of warnings produced by
GNU Fortran:

`-fsyntax-only'
     Check the code for syntax errors, but don't do anything beyond
     that.

`-pedantic'
     Issue warnings for uses of extensions to ANSI FORTRAN 77.
     `-pedantic' also applies to C-language constructs where they occur
     in GNU Fortran source files, such as use of `\e' in a character
     constant within a directive like `#include'.

     Valid ANSI FORTRAN 77 programs should compile properly with or
     without this option.  However, without this option, certain GNU
     extensions and traditional Fortran features are supported as well.
     With this option, many of them are rejected.

     Some users try to use `-pedantic' to check programs for strict ANSI
     conformance.  They soon find that it does not do quite what they
     want--it finds some non-ANSI practices, but not all.  However,
     improvements to `g77' in this area are welcome.

`-pedantic-errors'
     Like `-pedantic', except that errors are produced rather than
     warnings.

`-fpedantic'
     Like `-pedantic', but applies only to Fortran constructs.

`-w'
     Inhibit all warning messages.

`-Wno-globals'
     Inhibit warnings about use of a name as both a global name (a
     subroutine, function, or block data program unit, or a common
     block) and implicitly as the name of an intrinsic in a source file.

     Also inhibit warnings about inconsistent invocations and/or
     definitions of global procedures (function and subroutines).  Such
     inconsistencies include different numbers of arguments and
     different types of arguments.

`-Wimplicit'
     Warn whenever a variable, array, or function is implicitly
     declared.  Has an effect similar to using the `IMPLICIT NONE'
     statement in every program unit.  (Some Fortran compilers provide
     this feature by an option named `-u' or `/WARNINGS=DECLARATIONS'.)

`-Wunused'
     Warn whenever a variable is unused aside from its declaration.

`-Wuninitialized'
     Warn whenever an automatic variable is used without first being
     initialized.

     These warnings are possible only in optimizing compilation,
     because they require data-flow information that is computed only
     when optimizing.  If you don't specify `-O', you simply won't get
     these warnings.

     These warnings occur only for variables that are candidates for
     register allocation.  Therefore, they do not occur for a variable
     whose address is taken, or whose size is other than 1, 2, 4 or 8
     bytes.  Also, they do not occur for arrays, even when they are in
     registers.

     Note that there might be no warning about a variable that is used
     only to compute a value that itself is never used, because such
     computations may be deleted by data-flow analysis before the
     warnings are printed.

     These warnings are made optional because GNU Fortran is not smart
     enough to see all the reasons why the code might be correct
     despite appearing to have an error.  Here is one example of how
     this can happen:

          SUBROUTINE DISPAT(J)
          IF (J.EQ.1) I=1
          IF (J.EQ.2) I=4
          IF (J.EQ.3) I=5
          CALL FOO(I)
          END

     If the value of `J' is always 1, 2 or 3, then `I' is always
     initialized, but GNU Fortran doesn't know this.  Here is another
     common case:

          SUBROUTINE MAYBE(FLAG)
          LOGICAL FLAG
          IF (FLAG) VALUE = 9.4
          ...
          IF (FLAG) PRINT *, VALUE
          END

     This has no bug because `VALUE' is used only if it is set.

`-Wall'
     The `-Wunused' and `-Wuninitialized' options combined.  These are
     all the options which pertain to usage that we recommend avoiding
     and that we believe is easy to avoid.  (As more warnings are added
     to `g77', some might be added to the list enabled by `-Wall'.)

   The remaining `-W...' options are not implied by `-Wall' because
they warn about constructions that we consider reasonable to use, on
occasion, in clean programs.

`-Wsurprising'
     Warn about "suspicious" constructs that are interpreted by the
     compiler in a way that might well be surprising to someone reading
     the code.  These differences can result in subtle,
     compiler-dependent (even machine-dependent) behavioral differences.
     The constructs warned about include:

        * Expressions having two arithmetic operators in a row, such as
          `X*-Y'.  Such a construct is nonstandard, and can produce
          unexpected results in more complicated situations such as
          `X**-Y*Z'.  `g77', along with many other compilers, interprets
          this example differently than many programmers, and a few
          other compilers.  Specifically, `g77' interprets `X**-Y*Z' as
          `(X**(-Y))*Z', while others might think it should be
          interpreted as `X**(-(Y*Z))'.

          A revealing example is the constant expression `2**-2*1.',
          which `g77' evaluates to .25, while others might evaluate it
          to 0., the difference resulting from the way precedence
          affects type promotion.

          (The `-fpedantic' option also warns about expressions having
          two arithmetic operators in a row.)

        * Expressions with a unary minus followed by an operand and then
          a binary operator other than plus or minus.  For example,
          `-2**2' produces a warning, because the precedence is
          `-(2**2)', yielding -4, not `(-2)**2', which yields 4, and
          which might represent what a programmer expects.

          An example of an expression producing different results in a
          surprising way is `-I*S', where I holds the value
          `-2147483648' and S holds `0.5'.  On many systems, negating I
          results in the same value, not a positive number, because it
          is already the lower bound of what an `INTEGER(KIND=1)'
          variable can hold.  So, the expression evaluates to a
          positive number, while the "expected" interpretation,
          `(-I)*S', would evaluate to a negative number.

          Even cases such as `-I*J' produce warnings, even though, in
          most configurations and situations, there is no computational
          difference between the results of the two
          interpretations--the purpose of this warning is to warn about
          differing interpretations and encourage a better style of
          coding, not to identify only those places where bugs might
          exist in the user's code.

        * `DO' loops with `DO' variables that are not of integral
          type--that is, using `REAL' variables as loop control
          variables.  Although such loops can be written to work in the
          "obvious" way, the way `g77' is required by the Fortran
          standard to interpret such code is likely to be quite
          different from the way many programmers expect.  (This is
          true of all `DO' loops, but the differences are pronounced
          for non-integral loop control variables.)

          *Note Loops::, for more information.

`-Werror'
     Make all warnings into errors.

`-W'
     Turns on "extra warnings" and, if optimization is specified via
     `-O', the `-Wuninitialized' option.  (This might change in future
     versions of `g77'.)

     "Extra warnings" are issued for:

        * Unused parameters to a procedure (when `-Wunused' also is
          specified).

        * Overflows involving floating-point constants (not available
          for certain configurations).

   *Note Options to Request or Suppress Warnings: (gcc)Warning Options,
for information on more options offered by the GBE shared by `g77',
`gcc', and other GNU compilers.

   Some of these have no effect when compiling programs written in
Fortran:

`-Wcomment'

`-Wformat'

`-Wparentheses'

`-Wswitch'

`-Wtraditional'

`-Wshadow'

`-Wid-clash-LEN'

`-Wlarger-than-LEN'

`-Wconversion'

`-Waggregate-return'

`-Wredundant-decls'
     These options all could have some relevant meaning for GNU Fortran
     programs, but are not yet supported.


File: g77.info,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking G77

Options for Debugging Your Program or GNU Fortran
=================================================

   GNU Fortran has various special options that are used for debugging
either your program or `g77'.

`-g'
     Produce debugging information in the operating system's native
     format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
     debugging information.

     Support for this option in Fortran programs is incomplete.  In
     particular, names of variables and arrays in common blocks or that
     are storage-associated via `EQUIVALENCE' are unavailable to the
     debugger.

     However, version 0.5.19 of `g77' does provide this information in
     a rudimentary way, as controlled by the `-fdebug-kludge' option.

     *Note Options for Code Generation Conventions: Code Gen Options,
     for more information.

   *Note Options for Debugging Your Program or GNU CC: (gcc)Debugging
Options, for more information on debugging options.


File: g77.info,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking G77

Options That Control Optimization
=================================

   Most Fortran users will want to use no optimization when developing
and testing programs, and use `-O' or `-O2' when compiling programs for
late-cycle testing and for production use.

   The following flags have particular applicability when compiling
Fortran programs:

`-malign-double'
     (Intel 386 architecture only.)

     Noticeably improves performance of `g77' programs making heavy use
     of `REAL(KIND=2)' (`DOUBLE PRECISION') data on some systems.  In
     particular, systems using Pentium, Pentium Pro, 586, and 686
     implementations of the i386 architecture execute programs faster
     when `REAL(KIND=2)' (`DOUBLE PRECISION') data are aligned on
     64-bit boundaries in memory.

     This option can, at least, make benchmark results more consistent
     across various system configurations, versions of the program, and
     data sets.

     *Note:* The warning in the `gcc' documentation about this option
     does not apply, generally speaking, to Fortran code compiled by
     `g77'.

     *Also note:* `g77' fixes a `gcc' backend bug to allow
     `-malign-double' to work generally, not just with
     statically-allocated data.

     *Also also note:* The negative form of `-malign-double' is
     `-mno-align-double', not `-benign-double'.

`-ffloat-store'
     Might help a Fortran program that depends on exact IEEE conformance
     on some machines, but might slow down a program that doesn't.

`-fforce-mem'

`-fforce-addr'
     Might improve optimization of loops.

`-fno-inline'
     Don't compile statement functions inline.  Might reduce the size
     of a program unit--which might be at expense of some speed (though
     it should compile faster).  Note that if you are not optimizing,
     no functions can be expanded inline.

`-ffast-math'
     Might allow some programs designed to not be too dependent on IEEE
     behavior for floating-point to run faster, or die trying.

`-fstrength-reduce'
     Might make some loops run faster.

`-frerun-cse-after-loop'

`-fexpensive-optimizations'

`-fdelayed-branch'

`-fschedule-insns'

`-fschedule-insns2'

`-fcaller-saves'
     Might improve performance on some code.

`-funroll-loops'
     Definitely improves performance on some code.

`-funroll-all-loops'
     Definitely improves performance on some code.

`-fno-move-all-movables'

`-fno-reduce-all-givs'

`-fno-rerun-loop-opt'
     Each of these might improve performance on some code.

     Analysis of Fortran code optimization and the resulting
     optimizations triggered by the above options were contributed by
     Toon Moene (<toon@moene.indiv.nluug.nl>).

     These three options are intended to be removed someday, once they
     have helped determine the efficacy of various approaches to
     improving the performance of Fortran code.

     Please let us know how use of these options affects the
     performance of your production code.  We're particularly
     interested in code that runs faster when these options are
     *disabled*, and in non-Fortran code that benefits when they are
     *enabled* via the above `gcc' command-line options.

   *Note Options That Control Optimization: (gcc)Optimize Options, for
more information on options to optimize the generated machine code.


File: g77.info,  Node: Preprocessor Options,  Next: Directory Options,  Prev: Optimize Options,  Up: Invoking G77

Options Controlling the Preprocessor
====================================

   These options control the C preprocessor, which is run on each C
source file before actual compilation.

   *Note Options Controlling the Preprocessor: (gcc)Preprocessor
Options, for information on C preprocessor options.

   Some of these options also affect how `g77' processes the `INCLUDE'
directive.  Since this directive is processed even when preprocessing
is not requested, it is not described in this section.  *Note Options
for Directory Search: Directory Options, for information on how `g77'
processes the `INCLUDE' directive.

   However, the `INCLUDE' directive does not apply preprocessing to the
contents of the included file itself.

   Therefore, any file that contains preprocessor directives (such as
`#include', `#define', and `#if') must be included via the `#include'
directive, not via the `INCLUDE' directive.  Therefore, any file
containing preprocessor directives, if included, is necessarily
included by a file that itself contains preprocessor directives.


File: g77.info,  Node: Directory Options,  Next: Code Gen Options,  Prev: Preprocessor Options,  Up: Invoking G77

Options for Directory Search
============================

   These options affect how the `cpp' preprocessor searches for files
specified via the `#include' directive.  Therefore, when compiling
Fortran programs, they are meaningful when the preproecssor is used.

   Some of these options also affect how `g77' searches for files
specified via the `INCLUDE' directive, although files included by that
directive are not, themselves, preprocessed.  These options are:

`-I-'

`-IDIR'
     These affect interpretation of the `INCLUDE' directive (as well as
     of the `#include' directive of the `cpp' preprocessor).

     Note that `-IDIR' must be specified *without* any spaces between
     `-I' and the directory name--that is, `-Ifoo/bar' is valid, but
     `-I foo/bar' is rejected by the `g77' compiler (though the
     preprocessor supports the latter form).  Also note that the
     general behavior of `-I' and `INCLUDE' is pretty much the same as
     of `-I' with `#include' in the `cpp' preprocessor, with regard to
     looking for `header.gcc' files and other such things.

     *Note Options for Directory Search: (gcc)Directory Options, for
     information on the `-I' option.