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
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
|
@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
@c Free Software Foundation, Inc.
@c This is part of the G77 manual.
@c For copying conditions, see the file g77.texi.
@ignore
@c man begin COPYRIGHT
Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below). A copy of the license is
included in the gfdl(7) man page.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
@c man end
@c Set file name and title for the man page.
@setfilename g77
@settitle GNU project Fortran 77 compiler.
@c man begin SYNOPSIS
g77 [@option{-c}|@option{-S}|@option{-E}]
[@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
[@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
[@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
[@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
[@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
[@option{-o} @var{outfile}] @var{infile}@dots{}
Only the most useful options are listed here; see below for the
remainder.
@c man end
@c man begin SEEALSO
gpl(7), gfdl(7), fsf-funding(7),
cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
@file{ld}, @file{binutils} and @file{gdb}.
@c man end
@c man begin BUGS
For instructions on reporting bugs, see
@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug}
script to report bugs is recommended.
@c man end
@c man begin AUTHOR
See the Info entry for @command{g77} for contributors to GCC and G77@.
@c man end
@end ignore
@node Invoking G77
@chapter GNU Fortran Command Options
@cindex GNU Fortran command options
@cindex command options
@cindex options, GNU Fortran command
@c man begin DESCRIPTION
The @command{g77} command supports all the options supported by the
@command{gcc} command.
@xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
Collection (GCC)}, for information
on the non-Fortran-specific aspects of the @command{gcc} command (and,
therefore, the @command{g77} command).
@cindex options, negative forms
@cindex negative forms of options
All @command{gcc} and @command{g77} options
are accepted both by @command{g77} and by @command{gcc}
(as well as any other drivers built at the same time,
such as @command{g++}),
since adding @command{g77} to the @command{gcc} distribution
enables acceptance of @command{g77} options
by all of the relevant drivers.
In some cases, options have positive and negative forms;
the negative form of @option{-ffoo} would be @option{-fno-foo}.
This manual documents only one of these two forms, whichever
one is not the default.
@c man end
@menu
* Option Summary:: Brief list of all @command{g77} options,
without explanations.
* Overall Options:: Controlling the kind of output:
an executable, object files, assembler files,
or preprocessed source.
* Shorthand Options:: Options that are shorthand for other options.
* Fortran Dialect Options:: Controlling the variant of Fortran language
compiled.
* Warning Options:: How picky should the compiler be?
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
* Optimize Options:: How much optimization?
* Preprocessor Options:: Controlling header files and macro definitions.
Also, getting dependency information for Make.
* Directory Options:: Where to find header files and libraries.
Where to find the compiler executable files.
* Code Gen Options:: Specifying conventions for function calls, data layout
and register usage.
* Environment Variables:: Env vars that affect GNU Fortran.
@end menu
@node Option Summary
@section Option Summary
@c man begin OPTIONS
Here is a summary of all the options specific to GNU Fortran, grouped
by type. Explanations are in the following sections.
@table @emph
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{
-fversion -fset-g77-defaults -fno-silent}
@item Shorthand Options
@xref{Shorthand Options}.
@gccoptlist{
-ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly}
@item Fortran Language Options
@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
@gccoptlist{
-ffree-form -fno-fixed-form -ff90 @gol
-fvxt -fdollar-ok -fno-backslash @gol
-fno-ugly-args -fno-ugly-assign -fno-ugly-assumed @gol
-fugly-comma -fugly-complex -fugly-init -fugly-logint @gol
-fonetrip -ftypeless-boz @gol
-fintrin-case-initcap -fintrin-case-upper @gol
-fintrin-case-lower -fintrin-case-any @gol
-fmatch-case-initcap -fmatch-case-upper @gol
-fmatch-case-lower -fmatch-case-any @gol
-fsource-case-upper -fsource-case-lower @gol
-fsource-case-preserve @gol
-fsymbol-case-initcap -fsymbol-case-upper @gol
-fsymbol-case-lower -fsymbol-case-any @gol
-fcase-strict-upper -fcase-strict-lower @gol
-fcase-initcap -fcase-upper -fcase-lower -fcase-preserve @gol
-ff2c-intrinsics-delete -ff2c-intrinsics-hide @gol
-ff2c-intrinsics-disable -ff2c-intrinsics-enable @gol
-fbadu77-intrinsics-delete -fbadu77-intrinsics-hide @gol
-fbadu77-intrinsics-disable -fbadu77-intrinsics-enable @gol
-ff90-intrinsics-delete -ff90-intrinsics-hide @gol
-ff90-intrinsics-disable -ff90-intrinsics-enable @gol
-fgnu-intrinsics-delete -fgnu-intrinsics-hide @gol
-fgnu-intrinsics-disable -fgnu-intrinsics-enable @gol
-fmil-intrinsics-delete -fmil-intrinsics-hide @gol
-fmil-intrinsics-disable -fmil-intrinsics-enable @gol
-funix-intrinsics-delete -funix-intrinsics-hide @gol
-funix-intrinsics-disable -funix-intrinsics-enable @gol
-fvxt-intrinsics-delete -fvxt-intrinsics-hide @gol
-fvxt-intrinsics-disable -fvxt-intrinsics-enable @gol
-ffixed-line-length-@var{n} -ffixed-line-length-none}
@item Warning Options
@xref{Warning Options,,Options to Request or Suppress Warnings}.
@gccoptlist{
-fsyntax-only -pedantic -pedantic-errors -fpedantic @gol
-w -Wno-globals -Wimplicit -Wunused -Wuninitialized @gol
-Wall -Wsurprising @gol
-Werror -W}
@item Debugging Options
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
@gccoptlist{
-g}
@item Optimization Options
@xref{Optimize Options,,Options that Control Optimization}.
@gccoptlist{
-malign-double @gol
-ffloat-store -fforce-mem -fforce-addr -fno-inline @gol
-ffast-math -fstrength-reduce -frerun-cse-after-loop @gol
-funsafe-math-optimizations -ffinite-math-only -fno-trapping-math @gol
-fexpensive-optimizations -fdelayed-branch @gol
-fschedule-insns -fschedule-insn2 -fcaller-saves @gol
-funroll-loops -funroll-all-loops @gol
-fno-move-all-movables -fno-reduce-all-givs @gol
-fno-rerun-loop-opt}
@item Directory Options
@xref{Directory Options,,Options for Directory Search}.
@gccoptlist{
-I@var{dir} -I-}
@item Code Generation Options
@xref{Code Gen Options,,Options for Code Generation Conventions}.
@gccoptlist{
-fno-automatic -finit-local-zero -fno-f2c @gol
-ff2c-library -fno-underscoring -fno-ident @gol
-fpcc-struct-return -freg-struct-return @gol
-fshort-double -fno-common -fpack-struct @gol
-fzeros -fno-second-underscore @gol
-femulate-complex @gol
-falias-check -fargument-alias @gol
-fargument-noalias -fno-argument-noalias-global @gol
-fno-globals -fflatten-arrays @gol
-fbounds-check -ffortran-bounds-check}
@end table
@c man end
@menu
* Overall Options:: Controlling the kind of output:
an executable, object files, assembler files,
or preprocessed source.
* Shorthand Options:: Options that are shorthand for other options.
* Fortran Dialect Options:: Controlling the variant of Fortran language
compiled.
* Warning Options:: How picky should the compiler be?
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
* Optimize Options:: How much optimization?
* Preprocessor Options:: Controlling header files and macro definitions.
Also, getting dependency information for Make.
* Directory Options:: Where to find header files and libraries.
Where to find the compiler executable files.
* Code Gen Options:: Specifying conventions for function calls, data layout
and register usage.
@end menu
@node Overall Options
@section Options Controlling the Kind of Output
@cindex overall options
@cindex options, overall
@c man begin OPTIONS
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.
@cindex file name suffix
@cindex suffixes, file name
@cindex file name extension
@cindex extensions, file name
@cindex file type
@cindex types, 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.
@xref{Overall Options,,Options Controlling the Kind of
Output,gcc,Using the GNU Compiler Collection (GCC)}, for
information on suffixes recognized by GCC.
@table @gcctabopt
@cindex .f filename suffix
@cindex .for filename suffix
@cindex .FOR filename suffix
@item @var{file}.f
@item @var{file}.for
@item @var{file}.FOR
Fortran source code that should not be preprocessed.
Such source code cannot contain any preprocessor directives, such
as @code{#include}, @code{#define}, @code{#if}, and so on.
You can force @samp{.f} files to be preprocessed by @command{cpp} by using
@option{-x f77-cpp-input}.
@xref{LEX}.
@cindex preprocessor
@cindex C preprocessor
@cindex cpp preprocessor
@cindex Fortran preprocessor
@cindex cpp program
@cindex programs, cpp
@cindex .F filename suffix
@cindex .fpp filename suffix
@cindex .FPP filename suffix
@item @var{file}.F
@item @var{file}.fpp
@item @var{file}.FPP
Fortran source code that must be preprocessed (by the C preprocessor
@command{cpp}, which is part of GCC).
Note that preprocessing is not extended to the contents of
files included by the @code{INCLUDE} directive---the @code{#include}
preprocessor directive must be used instead.
@cindex Ratfor preprocessor
@cindex programs, @command{ratfor}
@cindex @samp{.r} filename suffix
@cindex @command{ratfor}
@item @var{file}.r
Ratfor source code, which must be preprocessed by the @command{ratfor}
command, which is available separately (as it is not yet part of the GNU
Fortran distribution).
A public domain version in C is at
@uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}.
@end table
UNIX users typically use the @file{@var{file}.f} and @file{@var{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{@var{file}.for} and @file{@var{file}.fpp} nomenclature.
@cindex #define
@cindex #include
@cindex #if
Use of the preprocessor @command{cpp} allows use of C-like
constructs such as @code{#define} and @code{#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 @code{#include} and, in
conjunction with @code{#define}, only @code{#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!
@emph{Note:} The @option{-traditional} and @option{-undef} flags are supplied
to @command{cpp} by default, to help avoid unpleasant surprises.
@xref{Preprocessor Options,,Options Controlling the Preprocessor,
gcc,Using the GNU Compiler Collection (GCC)}.
This means that ANSI C preprocessor features (such as the @samp{#}
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, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}.
Use the @option{-v} option to see exactly how the preprocessor is invoked.
@cindex /*
Unfortunately, the @option{-traditional} flag will not avoid an error from
anything that @command{cpp} sees as an unterminated C comment, such as:
@smallexample
C Some Fortran compilers accept /* as starting
C an inline comment.
@end smallexample
@xref{Trailing Comment}.
The following options that affect overall processing are recognized
by the @command{g77} and @command{gcc} commands in a GNU Fortran installation:
@table @gcctabopt
@cindex -fversion option
@cindex options, -fversion
@cindex printing version information
@cindex version information, printing
@cindex consistency checks
@cindex internal consistency checks
@cindex checks, of internal consistency
@item -fversion
Ensure that the @command{g77} version of the compiler phase is reported,
if run,
and, starting in @code{egcs} version 1.1,
that internal consistency checks in the @file{f771} program are run.
This option is supplied automatically when @option{-v} or @option{--verbose}
is specified as a command-line option for @command{g77} or @command{gcc}
and when the resulting commands compile Fortran source files.
In GCC 3.1, this is changed back to the behavior @command{gcc} displays
for @samp{.c} files.
@cindex -fset-g77-defaults option
@cindex options, -fset-g77-defaults
@item -fset-g77-defaults
@emph{Version info:}
This option was obsolete as of @code{egcs}
version 1.1.
The effect is instead achieved
by the @code{lang_init_options} routine
in @file{gcc/gcc/f/com.c}.
@cindex consistency checks
@cindex internal consistency checks
@cindex checks, of internal consistency
Set up whatever @command{gcc} options are to apply to Fortran
compilations, and avoid running internal consistency checks
that might take some time.
This option is supplied automatically when compiling Fortran code
via the @command{g77} or @command{gcc} command.
The description of this option is provided so that users seeing
it in the output of, say, @samp{g77 -v} understand why it is
there.
@cindex modifying @command{g77}
@cindex @command{g77}, modifying
Also, developers who run @code{f771} directly might want to specify it
by hand to get the same defaults as they would running @code{f771}
via @command{g77} or @command{gcc}
However, such developers should, after linking a new @code{f771}
executable, invoke it without this option once,
e.g. via @kbd{./f771 -quiet < /dev/null},
to ensure that they have not introduced any
internal inconsistencies (such as in the table of
intrinsics) before proceeding---@command{g77} will crash
with a diagnostic if it detects an inconsistency.
@cindex -fno-silent option
@cindex options, -fno-silent
@cindex f2c compatibility
@cindex compatibility, f2c
@cindex status, compilation
@cindex compilation, status
@cindex reporting compilation status
@cindex printing compilation status
@item -fno-silent
Print (to @code{stderr}) the names of the program units as
they are compiled, in a form similar to that used by popular
UNIX @command{f77} implementations and @command{f2c}
@end table
@xref{Overall Options,,Options Controlling the Kind of Output,
gcc,Using the GNU Compiler Collection (GCC)}, for information
on more options that control the overall operation of the @command{gcc} command
(and, by extension, the @command{g77} command).
@node Shorthand Options
@section Shorthand Options
@cindex shorthand options
@cindex options, shorthand
@cindex macro options
@cindex options, macro
The following options serve as ``shorthand''
for other options accepted by the compiler:
@table @gcctabopt
@cindex -fugly option
@cindex options, -fugly
@item -fugly
@cindex ugly features
@cindex features, ugly
@emph{Note:} This option is no longer supported.
The information, below, is provided to aid
in the conversion of old scripts.
Specify that certain ``ugly'' constructs are to be quietly accepted.
Same as:
@smallexample
-fugly-args -fugly-assign -fugly-assumed
-fugly-comma -fugly-complex -fugly-init
-fugly-logint
@end smallexample
These constructs are considered inappropriate to use in new
or well-maintained portable Fortran code, but widely used
in old code.
@xref{Distensions}, for more information.
@cindex -fno-ugly option
@cindex options, -fno-ugly
@item -fno-ugly
@cindex ugly features
@cindex features, ugly
Specify that all ``ugly'' constructs are to be noisily rejected.
Same as:
@smallexample
-fno-ugly-args -fno-ugly-assign -fno-ugly-assumed
-fno-ugly-comma -fno-ugly-complex -fno-ugly-init
-fno-ugly-logint
@end smallexample
@xref{Distensions}, for more information.
@cindex -ff66 option
@cindex options, -ff66
@item -ff66
@cindex FORTRAN 66
@cindex compatibility, FORTRAN 66
Specify that the program is written in idiomatic FORTRAN 66.
Same as @samp{-fonetrip -fugly-assumed}.
The @option{-fno-f66} option is the inverse of @option{-ff66}.
As such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}.
The meaning of this option is likely to be refined as future
versions of @command{g77} provide more compatibility with other
existing and obsolete Fortran implementations.
@cindex -ff77 option
@cindex options, -ff77
@item -ff77
@cindex UNIX f77
@cindex f2c compatibility
@cindex compatibility, f2c
@cindex f77 compatibility
@cindex compatibility, f77
Specify that the program is written in idiomatic UNIX FORTRAN 77
and/or the dialect accepted by the @command{f2c} product.
Same as @samp{-fbackslash -fno-typeless-boz}.
The meaning of this option is likely to be refined as future
versions of @command{g77} provide more compatibility with other
existing and obsolete Fortran implementations.
@cindex -fno-f77 option
@cindex options, -fno-f77
@item -fno-f77
@cindex UNIX f77
The @option{-fno-f77} option is @emph{not} the inverse
of @option{-ff77}.
It specifies that the program is not written in idiomatic UNIX
FORTRAN 77 or @command{f2c} but in a more widely portable dialect.
@option{-fno-f77} is the same as @option{-fno-backslash}.
The meaning of this option is likely to be refined as future
versions of @command{g77} provide more compatibility with other
existing and obsolete Fortran implementations.
@end table
@node Fortran Dialect Options
@section Options Controlling Fortran Dialect
@cindex dialect options
@cindex language, dialect options
@cindex options, dialect
The following options control the dialect of Fortran
that the compiler accepts:
@table @gcctabopt
@cindex -ffree-form option
@cindex options, -ffree-form
@cindex -fno-fixed-form option
@cindex options, -fno-fixed-form
@cindex source file format
@cindex free form
@cindex fixed form
@cindex Fortran 90, features
@item -ffree-form
@item -fno-fixed-form
Specify that the source file is written in free form
(introduced in Fortran 90) instead of the more-traditional fixed form.
@cindex -ff90 option
@cindex options, -ff90
@cindex Fortran 90, features
@item -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
@option{-fvxt}, @option{-ff90-intrinsics-enable}, and the
current level of support for Fortran 90.)
@xref{Fortran 90}, for more information.
@cindex -fvxt option
@cindex options, -fvxt
@item -fvxt
@cindex Fortran 90, features
@cindex VXT extensions
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 @option{-fno-vxt}.
@option{-fvxt} specifies that the VXT Fortran interpretations
for those constructs are to be chosen.
@xref{VXT Fortran}, for more information.
@cindex -fdollar-ok option
@cindex options, -fdollar-ok
@item -fdollar-ok
@cindex dollar sign
@cindex symbol names
@cindex character set
Allow @samp{$} as a valid character in a symbol name.
@cindex -fno-backslash option
@cindex options, -fno-backslash
@item -fno-backslash
@cindex backslash
@cindex character constants
@cindex Hollerith constants
Specify that @samp{\} is not to be specially interpreted in character
and Hollerith constants a la C and many UNIX Fortran compilers.
For example, with @option{-fbackslash} in effect, @samp{A\nB} specifies
three characters, with the second one being newline.
With @option{-fno-backslash}, it specifies four characters,
@samp{A}, @samp{\}, @samp{n}, and @samp{B}.
Note that @command{g77} implements a fairly general form of backslash
processing that is incompatible with the narrower forms supported
by some other compilers.
For example, @samp{'A\003B'} is a three-character string in @command{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.
@xref{Backslash in Constants}, for
information on why @option{-fbackslash} is the default
instead of @option{-fno-backslash}.
@cindex -fno-ugly-args option
@cindex options, -fno-ugly-args
@item -fno-ugly-args
Disallow passing Hollerith and typeless constants as actual
arguments (for example, @samp{CALL FOO(4HABCD)}).
@xref{Ugly Implicit Argument Conversion}, for more information.
@cindex -fugly-assign option
@cindex options, -fugly-assign
@item -fugly-assign
Use the same storage for a given variable regardless of
whether it is used to hold an assigned-statement label
(as in @samp{ASSIGN 10 TO I}) or used to hold numeric data
(as in @samp{I = 3}).
@xref{Ugly Assigned Labels}, for more information.
@cindex -fugly-assumed option
@cindex options, -fugly-assumed
@item -fugly-assumed
Assume any dummy array with a final dimension specified as @samp{1}
is really an assumed-size array, as if @samp{*} had been specified
for the final dimension instead of @samp{1}.
For example, @samp{DIMENSION X(1)} is treated as if it
had read @samp{DIMENSION X(*)}.
@xref{Ugly Assumed-Size Arrays}, for more information.
@cindex -fugly-comma option
@cindex options, -fugly-comma
@item -fugly-comma
In an external-procedure invocation,
treat a trailing comma in the argument list
as specification of a trailing null argument,
and treat an empty argument list
as specification of a single null argument.
For example, @samp{CALL FOO(,)} is treated as
@samp{CALL FOO(%VAL(0), %VAL(0))}.
That is, @emph{two} null arguments are specified
by the procedure call when @option{-fugly-comma} is in force.
And @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}.
The default behavior, @option{-fno-ugly-comma}, is to ignore
a single trailing comma in an argument list.
So, by default, @samp{CALL FOO(X,)} is treated
exactly the same as @samp{CALL FOO(X)}.
@xref{Ugly Null Arguments}, for more information.
@cindex -fugly-complex option
@cindex options, -fugly-complex
@item -fugly-complex
Do not complain about @samp{REAL(@var{expr})} or
@samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX}
type other than @code{COMPLEX(KIND=1)}---usually
this is used to permit @code{COMPLEX(KIND=2)}
(@code{DOUBLE COMPLEX}) operands.
The @option{-ff90} option controls the interpretation
of this construct.
@xref{Ugly Complex Part Extraction}, for more information.
@cindex -fno-ugly-init option
@cindex options, -fno-ugly-init
@item -fno-ugly-init
Disallow use of Hollerith and typeless constants as initial
values (in @code{PARAMETER} and @code{DATA} statements), and
use of character constants to
initialize numeric types and vice versa.
For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by
@option{-fno-ugly-init}.
@xref{Ugly Conversion of Initializers}, for more information.
@cindex -fugly-logint option
@cindex options, -fugly-logint
@item -fugly-logint
Treat @code{INTEGER} and @code{LOGICAL} variables and
expressions as potential stand-ins for each other.
For example, automatic conversion between @code{INTEGER} and
@code{LOGICAL} is enabled, for many contexts, via this option.
@xref{Ugly Integer Conversions}, for more information.
@cindex -fonetrip option
@cindex options, -fonetrip
@item -fonetrip
@cindex FORTRAN 66
@cindex @code{DO} loops, one-trip
@cindex one-trip @code{DO} loops
@cindex @code{DO} loops, zero-trip
@cindex zero-trip @code{DO} loops
@cindex compatibility, FORTRAN 66
Executable iterative @code{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 iterative @code{DO} loop is not executed
if the number of iterations calculated from the parameters of the
loop is less than 1.
(For example, @samp{DO 10 I = 1, 0}.)
Such a loop is called a @dfn{zero-trip loop}.
Prior to ANSI FORTRAN 77, many compilers implemented @code{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
@dfn{one-trip loops}.
For example, some code written to the FORTRAN 66 standard
expects this behavior from its @code{DO} loops, although that
standard did not specify this behavior.
The @option{-fonetrip} option specifies that the source file(s) being
compiled require one-trip loops.
This option affects only those loops specified by the (iterative) @code{DO}
statement and by implied-@code{DO} lists in I/O statements.
Loops specified by implied-@code{DO} lists in @code{DATA} and
specification (non-executable) statements are not affected.
@cindex -ftypeless-boz option
@cindex options, -ftypeless-boz
@cindex prefix-radix constants
@cindex constants, prefix-radix
@cindex constants, types
@cindex types, constants
@item -ftypeless-boz
Specifies that prefix-radix non-decimal constants, such as
@samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}.
You can test for yourself whether a particular compiler treats
the prefix form as @code{INTEGER(KIND=1)} or typeless by running the
following program:
@smallexample
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
@end smallexample
Reports indicate that many compilers process this form as
@code{INTEGER(KIND=1)}, though a few as typeless, and at least one
based on a command-line option specifying some kind of
compatibility.
@cindex -fintrin-case-initcap option
@cindex options, -fintrin-case-initcap
@item -fintrin-case-initcap
@cindex -fintrin-case-upper option
@cindex options, -fintrin-case-upper
@item -fintrin-case-upper
@cindex -fintrin-case-lower option
@cindex options, -fintrin-case-lower
@item -fintrin-case-lower
@cindex -fintrin-case-any option
@cindex options, -fintrin-case-any
@item -fintrin-case-any
Specify expected case for intrinsic names.
@option{-fintrin-case-lower} is the default.
@cindex -fmatch-case-initcap option
@cindex options, -fmatch-case-initcap
@item -fmatch-case-initcap
@cindex -fmatch-case-upper option
@cindex options, -fmatch-case-upper
@item -fmatch-case-upper
@cindex -fmatch-case-lower option
@cindex options, -fmatch-case-lower
@item -fmatch-case-lower
@cindex -fmatch-case-any option
@cindex options, -fmatch-case-any
@item -fmatch-case-any
Specify expected case for keywords.
@option{-fmatch-case-lower} is the default.
@cindex -fsource-case-upper option
@cindex options, -fsource-case-upper
@item -fsource-case-upper
@cindex -fsource-case-lower option
@cindex options, -fsource-case-lower
@item -fsource-case-lower
@cindex -fsource-case-preserve option
@cindex options, -fsource-case-preserve
@item -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.
@option{-fsource-case-lower} is the default.
@cindex -fsymbol-case-initcap option
@cindex options, -fsymbol-case-initcap
@item -fsymbol-case-initcap
@cindex -fsymbol-case-upper option
@cindex options, -fsymbol-case-upper
@item -fsymbol-case-upper
@cindex -fsymbol-case-lower option
@cindex options, -fsymbol-case-lower
@item -fsymbol-case-lower
@cindex -fsymbol-case-any option
@cindex options, -fsymbol-case-any
@item -fsymbol-case-any
Specify valid cases for user-defined symbol names.
@option{-fsymbol-case-any} is the default.
@cindex -fcase-strict-upper option
@cindex options, -fcase-strict-upper
@item -fcase-strict-upper
Same as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve
-fsymbol-case-upper}.
(Requires all pertinent source to be in uppercase.)
@cindex -fcase-strict-lower option
@cindex options, -fcase-strict-lower
@item -fcase-strict-lower
Same as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve
-fsymbol-case-lower}.
(Requires all pertinent source to be in lowercase.)
@cindex -fcase-initcap option
@cindex options, -fcase-initcap
@item -fcase-initcap
Same as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve
-fsymbol-case-initcap}.
(Requires all pertinent source to be in initial capitals,
as in @samp{Print *,SqRt(Value)}.)
@cindex -fcase-upper option
@cindex options, -fcase-upper
@item -fcase-upper
Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper
-fsymbol-case-any}.
(Maps all pertinent source to uppercase.)
@cindex -fcase-lower option
@cindex options, -fcase-lower
@item -fcase-lower
Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower
-fsymbol-case-any}.
(Maps all pertinent source to lowercase.)
@cindex -fcase-preserve option
@cindex options, -fcase-preserve
@item -fcase-preserve
Same as @samp{-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, @samp{call Foo(i,I)} would pass two @emph{different}
variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.)
@cindex -fbadu77-intrinsics-delete option
@cindex options, -fbadu77-intrinsics-delete
@item -fbadu77-intrinsics-delete
@cindex -fbadu77-intrinsics-hide option
@cindex options, -fbadu77-intrinsics-hide
@item -fbadu77-intrinsics-hide
@cindex -fbadu77-intrinsics-disable option
@cindex options, -fbadu77-intrinsics-disable
@item -fbadu77-intrinsics-disable
@cindex -fbadu77-intrinsics-enable option
@cindex options, -fbadu77-intrinsics-enable
@item -fbadu77-intrinsics-enable
@cindex @code{badu77} intrinsics
@cindex intrinsics, @code{badu77}
Specify status of UNIX intrinsics having inappropriate forms.
@option{-fbadu77-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -ff2c-intrinsics-delete option
@cindex options, -ff2c-intrinsics-delete
@item -ff2c-intrinsics-delete
@cindex -ff2c-intrinsics-hide option
@cindex options, -ff2c-intrinsics-hide
@item -ff2c-intrinsics-hide
@cindex -ff2c-intrinsics-disable option
@cindex options, -ff2c-intrinsics-disable
@item -ff2c-intrinsics-disable
@cindex -ff2c-intrinsics-enable option
@cindex options, -ff2c-intrinsics-enable
@item -ff2c-intrinsics-enable
@cindex @command{f2c} intrinsics
@cindex intrinsics, @command{f2c}
Specify status of f2c-specific intrinsics.
@option{-ff2c-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -ff90-intrinsics-delete option
@cindex options, -ff90-intrinsics-delete
@item -ff90-intrinsics-delete
@cindex -ff90-intrinsics-hide option
@cindex options, -ff90-intrinsics-hide
@item -ff90-intrinsics-hide
@cindex -ff90-intrinsics-disable option
@cindex options, -ff90-intrinsics-disable
@item -ff90-intrinsics-disable
@cindex -ff90-intrinsics-enable option
@cindex options, -ff90-intrinsics-enable
@item -ff90-intrinsics-enable
@cindex Fortran 90, intrinsics
@cindex intrinsics, Fortran 90
Specify status of F90-specific intrinsics.
@option{-ff90-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -fgnu-intrinsics-delete option
@cindex options, -fgnu-intrinsics-delete
@item -fgnu-intrinsics-delete
@cindex -fgnu-intrinsics-hide option
@cindex options, -fgnu-intrinsics-hide
@item -fgnu-intrinsics-hide
@cindex -fgnu-intrinsics-disable option
@cindex options, -fgnu-intrinsics-disable
@item -fgnu-intrinsics-disable
@cindex -fgnu-intrinsics-enable option
@cindex options, -fgnu-intrinsics-enable
@item -fgnu-intrinsics-enable
@cindex Digital Fortran features
@cindex @code{COMPLEX} intrinsics
@cindex intrinsics, @code{COMPLEX}
Specify status of Digital's COMPLEX-related intrinsics.
@option{-fgnu-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -fmil-intrinsics-delete option
@cindex options, -fmil-intrinsics-delete
@item -fmil-intrinsics-delete
@cindex -fmil-intrinsics-hide option
@cindex options, -fmil-intrinsics-hide
@item -fmil-intrinsics-hide
@cindex -fmil-intrinsics-disable option
@cindex options, -fmil-intrinsics-disable
@item -fmil-intrinsics-disable
@cindex -fmil-intrinsics-enable option
@cindex options, -fmil-intrinsics-enable
@item -fmil-intrinsics-enable
@cindex MIL-STD 1753
@cindex intrinsics, MIL-STD 1753
Specify status of MIL-STD-1753-specific intrinsics.
@option{-fmil-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -funix-intrinsics-delete option
@cindex options, -funix-intrinsics-delete
@item -funix-intrinsics-delete
@cindex -funix-intrinsics-hide option
@cindex options, -funix-intrinsics-hide
@item -funix-intrinsics-hide
@cindex -funix-intrinsics-disable option
@cindex options, -funix-intrinsics-disable
@item -funix-intrinsics-disable
@cindex -funix-intrinsics-enable option
@cindex options, -funix-intrinsics-enable
@item -funix-intrinsics-enable
@cindex UNIX intrinsics
@cindex intrinsics, UNIX
Specify status of UNIX intrinsics.
@option{-funix-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -fvxt-intrinsics-delete option
@cindex options, -fvxt-intrinsics-delete
@item -fvxt-intrinsics-delete
@cindex -fvxt-intrinsics-hide option
@cindex options, -fvxt-intrinsics-hide
@item -fvxt-intrinsics-hide
@cindex -fvxt-intrinsics-disable option
@cindex options, -fvxt-intrinsics-disable
@item -fvxt-intrinsics-disable
@cindex -fvxt-intrinsics-enable option
@cindex options, -fvxt-intrinsics-enable
@item -fvxt-intrinsics-enable
@cindex VXT intrinsics
@cindex intrinsics, VXT
Specify status of VXT intrinsics.
@option{-fvxt-intrinsics-enable} is the default.
@xref{Intrinsic Groups}.
@cindex -ffixed-line-length-@var{n} option
@cindex options, -ffixed-line-length-@var{n}
@item -ffixed-line-length-@var{n}
@cindex source file format
@cindex lines, length
@cindex length of source lines
@cindex fixed form
@cindex limits, lengths of source lines
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.
@cindex card image
@cindex extended-source option
Popular values for @var{n} include 72 (the
standard and the default), 80 (card image), and 132 (corresponds
to ``extended-source'' options in some popular compilers).
@var{n} may be @samp{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.
@option{-ffixed-line-length-0} means the same thing as
@option{-ffixed-line-length-none}.
@xref{Source Form}, for more information.
@end table
@node Warning Options
@section Options to Request or Suppress Warnings
@cindex options, warnings
@cindex warnings, suppressing
@cindex messages, warning
@cindex suppressing 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 @option{-W},
for example @option{-Wimplicit} to request warnings on implicit
declarations. Each of these specific warning options also has a
negative form beginning @option{-Wno-} to turn off warnings;
for example, @option{-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:
@table @gcctabopt
@cindex syntax checking
@cindex -fsyntax-only option
@cindex options, -fsyntax-only
@item -fsyntax-only
Check the code for syntax errors, but don't do anything beyond that.
@cindex -pedantic option
@cindex options, -pedantic
@item -pedantic
Issue warnings for uses of extensions to ANSI FORTRAN 77.
@option{-pedantic} also applies to C-language constructs where they
occur in GNU Fortran source files, such as use of @samp{\e} in a
character constant within a directive like @samp{#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 @option{-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 @command{g77} in this area are welcome.
@cindex -pedantic-errors option
@cindex options, -pedantic-errors
@item -pedantic-errors
Like @option{-pedantic}, except that errors are produced rather than
warnings.
@cindex -fpedantic option
@cindex options, -fpedantic
@item -fpedantic
Like @option{-pedantic}, but applies only to Fortran constructs.
@cindex -w option
@cindex options, -w
@item -w
Inhibit all warning messages.
@cindex -Wno-globals option
@cindex options, -Wno-globals
@item -Wno-globals
@cindex global names, warning
@cindex warnings, global names
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.
@cindex -Wimplicit option
@cindex options, -Wimplicit
@item -Wimplicit
@cindex implicit declaration, warning
@cindex warnings, implicit declaration
@cindex -u option
@cindex /WARNINGS=DECLARATIONS switch
@cindex IMPLICIT NONE, similar effect
@cindex effecting IMPLICIT NONE
Warn whenever a variable, array, or function is implicitly
declared.
Has an effect similar to using the @code{IMPLICIT NONE} statement
in every program unit.
(Some Fortran compilers provide this feature by an option
named @option{-u} or @samp{/WARNINGS=DECLARATIONS}.)
@cindex -Wunused option
@cindex options, -Wunused
@item -Wunused
@cindex unused variables
@cindex variables, unused
Warn whenever a variable is unused aside from its declaration.
@cindex -Wuninitialized option
@cindex options, -Wuninitialized
@item -Wuninitialized
@cindex uninitialized variables
@cindex variables, uninitialized
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 @option{-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
@c that is declared @code{VOLATILE}, or
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:
@example
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
@end example
@noindent
If the value of @code{J} is always 1, 2 or 3, then @code{I} is
always initialized, but GNU Fortran doesn't know this. Here is
another common case:
@example
SUBROUTINE MAYBE(FLAG)
LOGICAL FLAG
IF (FLAG) VALUE = 9.4
@dots{}
IF (FLAG) PRINT *, VALUE
END
@end example
@noindent
This has no bug because @code{VALUE} is used only if it is set.
@cindex -Wall option
@cindex options, -Wall
@item -Wall
@cindex all warnings
@cindex warnings, all
The @option{-Wunused} and @option{-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 @command{g77} some might
be added to the list enabled by @option{-Wall}.)
@end table
The remaining @option{-W@dots{}} options are not implied by @option{-Wall}
because they warn about constructions that we consider reasonable to
use, on occasion, in clean programs.
@table @gcctabopt
@c @item -W
@c Print extra warning messages for these events:
@c
@c @itemize @bullet
@c @item
@c If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
@c arguments.
@c
@c @end itemize
@c
@cindex -Wsurprising option
@cindex options, -Wsurprising
@item -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:
@itemize @bullet
@item
Expressions having two arithmetic operators in a row, such
as @samp{X*-Y}.
Such a construct is nonstandard, and can produce
unexpected results in more complicated situations such
as @samp{X**-Y*Z}.
@command{g77} along with many other compilers, interprets
this example differently than many programmers, and a few
other compilers.
Specifically, @command{g77} interprets @samp{X**-Y*Z} as
@samp{(X**(-Y))*Z}, while others might think it should
be interpreted as @samp{X**(-(Y*Z))}.
A revealing example is the constant expression @samp{2**-2*1.},
which @command{g77} evaluates to .25, while others might evaluate
it to 0., the difference resulting from the way precedence affects
type promotion.
(The @option{-fpedantic} option also warns about expressions
having two arithmetic operators in a row.)
@item
Expressions with a unary minus followed by an operand and then
a binary operator other than plus or minus.
For example, @samp{-2**2} produces a warning, because
the precedence is @samp{-(2**2)}, yielding -4, not
@samp{(-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 @samp{-I*S}, where @var{I} holds
the value @samp{-2147483648} and @var{S} holds @samp{0.5}.
On many systems, negating @var{I} results in the same
value, not a positive number, because it is already the
lower bound of what an @code{INTEGER(KIND=1)} variable can hold.
So, the expression evaluates to a positive number, while
the ``expected'' interpretation, @samp{(-I)*S}, would
evaluate to a negative number.
Even cases such as @samp{-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.
@cindex DO statement
@cindex statements, DO
@item
@code{DO} loops with @code{DO} variables that are not
of integral type---that is, using @code{REAL}
variables as loop control variables.
Although such loops can be written to work in the
``obvious'' way, the way @command{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 @code{DO} loops, but the differences
are pronounced for non-integral loop control variables.)
@xref{Loops}, for more information.
@end itemize
@cindex -Werror option
@cindex options, -Werror
@item -Werror
Make all warnings into errors.
@cindex -W option
@cindex options, -W
@item -W
@cindex extra warnings
@cindex warnings, extra
Turns on ``extra warnings'' and, if optimization is specified
via @option{-O}, the @option{-Wuninitialized} option.
(This might change in future versions of @command{g77}
``Extra warnings'' are issued for:
@itemize @bullet
@item
@cindex unused parameters
@cindex parameters, unused
@cindex unused arguments
@cindex arguments, unused
@cindex unused dummies
@cindex dummies, unused
Unused parameters to a procedure (when @option{-Wunused} also is
specified).
@item
@cindex overflow
Overflows involving floating-point constants (not available
for certain configurations).
@end itemize
@end table
@xref{Warning Options,,Options to Request or Suppress Warnings,
gcc,Using the GNU Compiler Collection (GCC)}, for information on more
options offered
by the GBE shared by @command{g77} @command{gcc} and other GNU compilers.
Some of these have no effect when compiling programs written in Fortran:
@table @gcctabopt
@cindex -Wcomment option
@cindex options, -Wcomment
@item -Wcomment
@cindex -Wformat option
@cindex options, -Wformat
@item -Wformat
@cindex -Wparentheses option
@cindex options, -Wparentheses
@item -Wparentheses
@cindex -Wswitch option
@cindex options, -Wswitch
@item -Wswitch
@cindex -Wswitch-default option
@cindex options, -Wswitch-default
@item -Wswitch-default
@cindex -Wswitch-enum option
@cindex options, -Wswitch-enum
@item -Wswitch-enum
@cindex -Wtraditional option
@cindex options, -Wtraditional
@item -Wtraditional
@cindex -Wshadow option
@cindex options, -Wshadow
@item -Wshadow
@cindex -Wid-clash-@var{len} option
@cindex options, -Wid-clash-@var{len}
@item -Wid-clash-@var{len}
@cindex -Wlarger-than-@var{len} option
@cindex options, -Wlarger-than-@var{len}
@item -Wlarger-than-@var{len}
@cindex -Wconversion option
@cindex options, -Wconversion
@item -Wconversion
@cindex -Waggregate-return option
@cindex options, -Waggregate-return
@item -Waggregate-return
@cindex -Wredundant-decls option
@cindex options, -Wredundant-decls
@item -Wredundant-decls
@cindex unsupported warnings
@cindex warnings, unsupported
These options all could have some relevant meaning for
GNU Fortran programs, but are not yet supported.
@end table
@node Debugging Options
@section Options for Debugging Your Program or GNU Fortran
@cindex options, debugging
@cindex debugging information options
GNU Fortran has various special options that are used for debugging
either your program or @command{g77}
@table @gcctabopt
@cindex -g option
@cindex options, -g
@item -g
Produce debugging information in the operating system's native format
(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
information.
A sample debugging session looks like this (note the use of the breakpoint):
@smallexample
$ cat gdb.f
PROGRAM PROG
DIMENSION A(10)
DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./
A(5) = 4.
PRINT*,A
END
$ g77 -g -O gdb.f
$ gdb a.out
...
(gdb) break MAIN__
Breakpoint 1 at 0x8048e96: file gdb.f, line 4.
(gdb) run
Starting program: /home/toon/g77-bugs/./a.out
Breakpoint 1, MAIN__ () at gdb.f:4
4 A(5) = 4.
Current language: auto; currently fortran
(gdb) print a(5)
$1 = 5
(gdb) step
5 PRINT*,A
(gdb) print a(5)
$2 = 4
...
@end smallexample
One could also add the setting of the breakpoint and the first run command
to the file @file{.gdbinit} in the current directory, to simplify the debugging
session.
@end table
@xref{Debugging Options,,Options for Debugging Your Program or GCC,
gcc,Using the GNU Compiler Collection (GCC)}, for more information on
debugging options.
@node Optimize Options
@section Options That Control Optimization
@cindex optimize options
@cindex options, optimization
Most Fortran users will want to use no optimization when
developing and testing programs, and use @option{-O} or @option{-O2} when
compiling programs for late-cycle testing and for production use.
However, note that certain diagnostics---such as for uninitialized
variables---depend on the flow analysis done by @option{-O}, i.e.@: you
must use @option{-O} or @option{-O2} to get such diagnostics.
The following flags have particular applicability when
compiling Fortran programs:
@table @gcctabopt
@cindex -malign-double option
@cindex options, -malign-double
@item -malign-double
(Intel x86 architecture only.)
Noticeably improves performance of @command{g77} programs making
heavy use of @code{REAL(KIND=2)} (@code{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
@code{REAL(KIND=2)} (@code{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.
@emph{Note:} The warning in the @command{gcc} documentation about
this option does not apply, generally speaking, to Fortran
code compiled by @command{g77}
@xref{Aligned Data}, for more information on alignment issues.
@emph{Also also note:} The negative form of @option{-malign-double}
is @option{-mno-align-double}, not @option{-benign-double}.
@cindex -ffloat-store option
@cindex options, -ffloat-store
@item -ffloat-store
@cindex IEEE 754 conformance
@cindex conformance, IEEE 754
@cindex floating-point, precision
Might help a Fortran program that depends on exact IEEE conformance on
some machines, but might slow down a program that doesn't.
This option is effective when the floating-point unit is set to work in
IEEE 854 `extended precision'---as it typically is on x86 and m68k GNU
systems---rather than IEEE 754 double precision. @option{-ffloat-store}
tries to remove the extra precision by spilling data from floating-point
registers into memory and this typically involves a big performance
hit. However, it doesn't affect intermediate results, so that it is
only partially effective. `Excess precision' is avoided in code like:
@smallexample
a = b + c
d = a * e
@end smallexample
but not in code like:
@smallexample
d = (b + c) * e
@end smallexample
For another, potentially better, way of controlling the precision,
see @ref{Floating-point precision}.
@cindex -fforce-mem option
@cindex options, -fforce-mem
@item -fforce-mem
@cindex -fforce-addr option
@cindex options, -fforce-addr
@item -fforce-addr
@cindex loops, speeding up
@cindex speed, of loops
Might improve optimization of loops.
@cindex -fno-inline option
@cindex options, -fno-inline
@item -fno-inline
@cindex in-line code
@cindex compilation, in-line
@c DL: Only relevant for -O3? TM: No, statement functions are
@c inlined even at -O1.
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.
@cindex -ffast-math option
@cindex options, -ffast-math
@item -ffast-math
@cindex IEEE 754 conformance
@cindex conformance, IEEE 754
Might allow some programs designed to not be too dependent
on IEEE behavior for floating-point to run faster, or die trying.
Sets @option{-funsafe-math-optimizations}, @option{-ffinite-math-only},
and @option{-fno-trapping-math}.
@cindex -funsafe-math-optimizations option
@cindex options, -funsafe-math-optimizations
@item -funsafe-math-optimizations
Allow optimizations that may be give incorrect results
for certain IEEE inputs.
@cindex -ffinite-math-only option
@cindex options, -ffinite-math-only
@item -ffinite-math-only
Allow optimizations for floating-point arithmetic that assume
that arguments and results are not NaNs or +-Infs.
This option should never be turned on by any @option{-O} option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications.
The default is @option{-fno-finite-math-only}.
@cindex -fno-trapping-math option
@cindex options, -fno-trapping-math
@item -fno-trapping-math
Allow the compiler to assume that floating-point arithmetic
will not generate traps on any inputs. This is useful, for
example, when running a program using IEEE "non-stop"
floating-point arithmetic.
@cindex -fstrength-reduce option
@cindex options, -fstrength-reduce
@item -fstrength-reduce
@cindex loops, speeding up
@cindex speed, of loops
@c DL: normally defaulted?
Might make some loops run faster.
@cindex -frerun-cse-after-loop option
@cindex options, -frerun-cse-after-loop
@item -frerun-cse-after-loop
@cindex -fexpensive-optimizations option
@cindex options, -fexpensive-optimizations
@c DL: This is -O2?
@item -fexpensive-optimizations
@cindex -fdelayed-branch option
@cindex options, -fdelayed-branch
@item -fdelayed-branch
@cindex -fschedule-insns option
@cindex options, -fschedule-insns
@item -fschedule-insns
@cindex -fschedule-insns2 option
@cindex options, -fschedule-insns2
@item -fschedule-insns2
@cindex -fcaller-saves option
@cindex options, -fcaller-saves
@item -fcaller-saves
Might improve performance on some code.
@cindex -funroll-loops option
@cindex options, -funroll-loops
@item -funroll-loops
@cindex loops, unrolling
@cindex unrolling loops
@cindex loops, optimizing
@cindex indexed (iterative) @code{DO}
@cindex iterative @code{DO}
@c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to
@c provide a suitable term
@c CB: I've decided on `iterative', for the time being, and changed
@c my previous, rather bizarre, use of `imperative' to that
@c (though `precomputed-trip' would be a more precise adjective)
Typically improves performance on code using iterative @code{DO} loops by
unrolling them and is probably generally appropriate for Fortran, though
it is not turned on at any optimization level.
Note that outer loop unrolling isn't done specifically; decisions about
whether to unroll a loop are made on the basis of its instruction count.
@c DL: Fixme: This should obviously go somewhere else...
Also, no `loop discovery'@footnote{@dfn{loop discovery} refers to the
process by which a compiler, or indeed any reader of a program,
determines which portions of the program are more likely to be executed
repeatedly as it is being run. Such discovery typically is done early
when compiling using optimization techniques, so the ``discovered''
loops get more attention---and more run-time resources, such as
registers---from the compiler. It is easy to ``discover'' loops that are
constructed out of looping constructs in the language
(such as Fortran's @code{DO}). For some programs, ``discovering'' loops
constructed out of lower-level constructs (such as @code{IF} and
@code{GOTO}) can lead to generation of more optimal code
than otherwise.} is done, so only loops written with @code{DO}
benefit from loop optimizations, including---but not limited
to---unrolling. Loops written with @code{IF} and @code{GOTO} are not
currently recognized as such. This option unrolls only iterative
@code{DO} loops, not @code{DO WHILE} loops.
@cindex -funroll-all-loops option
@cindex options, -funroll-all-loops
@cindex DO WHILE
@item -funroll-all-loops
@c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct.
Probably improves performance on code using @code{DO WHILE} loops by
unrolling them in addition to iterative @code{DO} loops. In the absence
of @code{DO WHILE}, this option is equivalent to @option{-funroll-loops}
but possibly slower.
@item -fno-move-all-movables
@cindex -fno-move-all-movables option
@cindex options, -fno-move-all-movables
@item -fno-reduce-all-givs
@cindex -fno-reduce-all-givs option
@cindex options, -fno-reduce-all-givs
@item -fno-rerun-loop-opt
@cindex -fno-rerun-loop-opt option
@cindex options, -fno-rerun-loop-opt
In general, the optimizations enabled with these options will lead to
faster code being generated by GNU Fortran; hence they are enabled by default
when issuing the @command{g77} command.
@option{-fmove-all-movables} and @option{-freduce-all-givs} will enable
loop optimization to move all loop-invariant index computations in nested
loops over multi-rank array dummy arguments out of these loops.
@option{-frerun-loop-opt} will move offset calculations resulting
from the fact that Fortran arrays by default have a lower bound of 1
out of the loops.
These three options are intended to be removed someday, once
loop optimization is sufficiently advanced to perform all those
transformations without help from these options.
@end table
@xref{Optimize Options,,Options That Control Optimization,
gcc,Using the GNU Compiler Collection (GCC)}, for more information on options
to optimize the generated machine code.
@node Preprocessor Options
@section Options Controlling the Preprocessor
@cindex preprocessor options
@cindex options, preprocessor
@cindex cpp program
@cindex programs, cpp
These options control the C preprocessor, which is run on each C source
file before actual compilation.
@xref{Preprocessor Options,,Options Controlling the Preprocessor,
gcc,Using the GNU Compiler Collection (GCC)}, for information on C
preprocessor options.
@cindex INCLUDE directive
@cindex directive, INCLUDE
Some of these options also affect how @command{g77} processes the
@code{INCLUDE} directive.
Since this directive is processed even when preprocessing
is not requested, it is not described in this section.
@xref{Directory Options,,Options for Directory Search}, for
information on how @command{g77} processes the @code{INCLUDE} directive.
However, the @code{INCLUDE} directive does not apply
preprocessing to the contents of the included file itself.
Therefore, any file that contains preprocessor directives
(such as @code{#include}, @code{#define}, and @code{#if})
must be included via the @code{#include} directive, not
via the @code{INCLUDE} directive.
Therefore, any file containing preprocessor directives,
if included, is necessarily included by a file that itself
contains preprocessor directives.
@node Directory Options
@section Options for Directory Search
@cindex directory, options
@cindex options, directory search
@cindex search path
These options affect how the @command{cpp} preprocessor searches
for files specified via the @code{#include} directive.
Therefore, when compiling Fortran programs, they are meaningful
when the preprocessor is used.
@cindex INCLUDE directive
@cindex directive, INCLUDE
Some of these options also affect how @command{g77} searches
for files specified via the @code{INCLUDE} directive,
although files included by that directive are not,
themselves, preprocessed.
These options are:
@table @gcctabopt
@cindex -I- option
@cindex options, -I-
@item -I-
@cindex -Idir option
@cindex options, -Idir
@item -I@var{dir}
@cindex directory, search paths for inclusion
@cindex inclusion, directory search paths for
@cindex search paths, for included files
@cindex paths, search
These affect interpretation of the @code{INCLUDE} directive
(as well as of the @code{#include} directive of the @command{cpp}
preprocessor).
Note that @option{-I@var{dir}} must be specified @emph{without} any
spaces between @option{-I} and the directory name---that is,
@option{-Ifoo/bar} is valid, but @option{-I foo/bar}
is rejected by the @command{g77} compiler (though the preprocessor supports
the latter form).
@c this is due to toplev.c's inflexible option processing
Also note that the general behavior of @option{-I} and
@code{INCLUDE} is pretty much the same as of @option{-I} with
@code{#include} in the @command{cpp} preprocessor, with regard to
looking for @file{header.gcc} files and other such things.
@xref{Directory Options,,Options for Directory Search,
gcc,Using the GNU Compiler Collection (GCC)}, for information on the
@option{-I} option.
@end table
@node Code Gen Options
@section Options for Code Generation Conventions
@cindex code generation, conventions
@cindex options, code generation
@cindex run-time, options
These machine-independent options control the interface conventions
used in code generation.
Most of them have both positive and negative forms; the negative form
of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
one of the forms is listed---the one which is not the default. You
can figure out the other form by either removing @option{no-} or adding
it.
@table @gcctabopt
@cindex -fno-automatic option
@cindex options, -fno-automatic
@item -fno-automatic
@cindex SAVE statement
@cindex statements, SAVE
Treat each program unit as if the @code{SAVE} statement was specified
for every local variable and array referenced in it.
Does not affect common blocks.
(Some Fortran compilers provide this option under
the name @option{-static}.)
@cindex -finit-local-zero option
@cindex options, -finit-local-zero
@item -finit-local-zero
@cindex DATA statement
@cindex statements, DATA
@cindex initialization, of local variables
@cindex variables, initialization of
@cindex uninitialized variables
@cindex variables, uninitialized
Specify that variables and arrays that are local to a program unit
(not in a common block and not passed as an argument) are to be initialized
to binary zeros.
Since there is a run-time penalty for initialization of variables
that are not given the @code{SAVE} attribute, it might be a
good idea to also use @option{-fno-automatic} with @option{-finit-local-zero}.
@cindex -fno-f2c option
@cindex options, -fno-f2c
@item -fno-f2c
@cindex @command{f2c} compatibility
@cindex compatibility, @command{f2c}
Do not generate code designed to be compatible with code generated
by @command{f2c} use the GNU calling conventions instead.
The @command{f2c} calling conventions require functions that return
type @code{REAL(KIND=1)} to actually return the C type @code{double},
and functions that return type @code{COMPLEX} to return the
values via an extra argument in the calling sequence that points
to where to store the return value.
Under the GNU calling conventions, such functions simply return
their results as they would in GNU C---@code{REAL(KIND=1)} functions
return the C type @code{float}, and @code{COMPLEX} functions
return the GNU C type @code{complex} (or its @code{struct}
equivalent).
This does not affect the generation of code that interfaces with the
@code{libg2c} library.
However, because the @code{libg2c} library uses @command{f2c}
calling conventions, @command{g77} rejects attempts to pass
intrinsics implemented by routines in this library as actual
arguments when @option{-fno-f2c} is used, to avoid bugs when
they are actually called by code expecting the GNU calling
conventions to work.
For example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is
rejected when @option{-fno-f2c} is in force.
(Future versions of the @command{g77} run-time library might
offer routines that provide GNU-callable versions of the
routines that implement the @command{f2c} intrinsics
that may be passed as actual arguments, so that
valid programs need not be rejected when @option{-fno-f2c}
is used.)
@strong{Caution:} If @option{-fno-f2c} is used when compiling any
source file used in a program, it must be used when compiling
@emph{all} Fortran source files used in that program.
@c seems kinda dumb to tell people about an option they can't use -- jcb
@c then again, we want users building future-compatible libraries with it.
@cindex -ff2c-library option
@cindex options, -ff2c-library
@item -ff2c-library
Specify that use of @code{libg2c} (or the original @code{libf2c})
is required.
This is the default for the current version of @command{g77}
Currently it is not
valid to specify @option{-fno-f2c-library}.
This option is provided so users can specify it in shell
scripts that build programs and libraries that require the
@code{libf2c} library, even when being compiled by future
versions of @command{g77} that might otherwise default to
generating code for an incompatible library.
@cindex -fno-underscoring option
@cindex options, -fno-underscoring
@item -fno-underscoring
@cindex underscore
@cindex symbol names, underscores
@cindex transforming symbol names
@cindex symbol names, transforming
Do not transform names of entities specified in the Fortran
source file by appending underscores to them.
With @option{-funderscoring} in effect, @command{g77} appends two underscores
to names with underscores and one underscore to external names with
no underscores. (@command{g77} also appends two underscores to internal
names with underscores to avoid naming collisions with external names.
The @option{-fno-second-underscore} option disables appending of the
second underscore in all cases.)
This is done to ensure compatibility with code produced by many
UNIX Fortran compilers, including @command{f2c} which perform the
same transformations.
Use of @option{-fno-underscoring} is not recommended unless you are
experimenting with issues such as integration of (GNU) Fortran into
existing system environments (vis-a-vis existing libraries, tools, and
so on).
For example, with @option{-funderscoring}, and assuming other defaults like
@option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
external functions while @samp{my_var} and @samp{lvar} are local variables,
a statement like
@smallexample
I = J() + MAX_COUNT (MY_VAR, LVAR)
@end smallexample
@noindent
is implemented as something akin to:
@smallexample
i = j_() + max_count__(&my_var__, &lvar);
@end smallexample
With @option{-fno-underscoring}, the same statement is implemented as:
@smallexample
i = j() + max_count(&my_var, &lvar);
@end smallexample
Use of @option{-fno-underscoring} allows direct specification of
user-defined names while debugging and when interfacing @command{g77}
code with other languages.
Note that just because the names match does @emph{not} mean that the
interface implemented by @command{g77} for an external name matches the
interface implemented by some other language for that same name.
That is, getting code produced by @command{g77} to link to code produced
by some other compiler using this or any other method can be only a
small part of the overall solution---getting the code generated by
both compilers to agree on issues other than naming can require
significant effort, and, unlike naming disagreements, linkers normally
cannot detect disagreements in these other areas.
Also, note that with @option{-fno-underscoring}, the lack of appended
underscores introduces the very real possibility that a user-defined
external name will conflict with a name in a system library, which
could make finding unresolved-reference bugs quite difficult in some
cases---they might occur at program run time, and show up only as
buggy behavior at run time.
In future versions of @command{g77} we hope to improve naming and linking
issues so that debugging always involves using the names as they appear
in the source, even if the names as seen by the linker are mangled to
prevent accidental linking between procedures with incompatible
interfaces.
@cindex -fno-second-underscore option
@cindex options, -fno-second-underscore
@item -fno-second-underscore
@cindex underscore
@cindex symbol names, underscores
@cindex transforming symbol names
@cindex symbol names, transforming
Do not append a second underscore to names of entities specified
in the Fortran source file.
This option has no effect if @option{-fno-underscoring} is
in effect.
Otherwise, with this option, an external name such as @samp{MAX_COUNT}
is implemented as a reference to the link-time external symbol
@samp{max_count_}, instead of @samp{max_count__}.
@cindex -fno-ident option
@cindex options, -fno-ident
@item -fno-ident
Ignore the @samp{#ident} directive.
@cindex -fzeros option
@cindex options, -fzeros
@item -fzeros
Treat initial values of zero as if they were any other value.
As of version 0.5.18, @command{g77} normally treats @code{DATA} and
other statements that are used to specify initial values of zero
for variables and arrays as if no values were actually specified,
in the sense that no diagnostics regarding multiple initializations
are produced.
This is done to speed up compiling of programs that initialize
large arrays to zeros.
Use @option{-fzeros} to revert to the simpler, slower behavior
that can catch multiple initializations by keeping track of
all initializations, zero or otherwise.
@emph{Caution:} Future versions of @command{g77} might disregard this option
(and its negative form, the default) or interpret it somewhat
differently.
The interpretation changes will affect only non-standard
programs; standard-conforming programs should not be affected.
@cindex -femulate-complex option
@cindex options, -femulate-complex
@item -femulate-complex
Implement @code{COMPLEX} arithmetic via emulation,
instead of using the facilities of
the @command{gcc} back end that provide direct support of
@code{complex} arithmetic.
(@command{gcc} had some bugs in its back-end support
for @code{complex} arithmetic, due primarily to the support not being
completed as of version 2.8.1 and @code{egcs} 1.1.2.)
Use @option{-femulate-complex} if you suspect code-generation bugs,
or experience compiler crashes,
that might result from @command{g77} using the @code{COMPLEX} support
in the @command{gcc} back end.
If using that option fixes the bugs or crashes you are seeing,
that indicates a likely @command{g77} bugs
(though, all compiler crashes are considered bugs),
so, please report it.
(Note that the known bugs, now believed fixed, produced compiler crashes
rather than causing the generation of incorrect code.)
Use of this option should not affect how Fortran code compiled
by @command{g77} works in terms of its interfaces to other code,
e.g. that compiled by @command{f2c}
As of GCC version 3.0, this option is not necessary anymore.
@emph{Caution:} Future versions of @command{g77} might ignore both forms
of this option.
@cindex -falias-check option
@cindex options, -falias-check
@cindex -fargument-alias option
@cindex options, -fargument-alias
@cindex -fargument-noalias option
@cindex options, -fargument-noalias
@cindex -fno-argument-noalias-global option
@cindex options, -fno-argument-noalias-global
@item -falias-check
@item -fargument-alias
@item -fargument-noalias
@item -fno-argument-noalias-global
@emph{Version info:}
These options are not supported by
versions of @command{g77} based on @command{gcc} version 2.8.
These options specify to what degree aliasing
(overlap)
is permitted between
arguments (passed as pointers) and @code{COMMON} (external, or
public) storage.
The default for Fortran code, as mandated by the FORTRAN 77 and
Fortran 90 standards, is @option{-fargument-noalias-global}.
The default for code written in the C language family is
@option{-fargument-alias}.
Note that, on some systems, compiling with @option{-fforce-addr} in
effect can produce more optimal code when the default aliasing
options are in effect (and when optimization is enabled).
@xref{Aliasing Assumed To Work}, for detailed information on the implications
of compiling Fortran code that depends on the ability to alias dummy
arguments.
@cindex -fno-globals option
@cindex options, -fno-globals
@item -fno-globals
@cindex global names, warning
@cindex warnings, global names
@cindex in-line code
@cindex compilation, in-line
Disable diagnostics about inter-procedural
analysis problems, such as disagreements about the
type of a function or a procedure's argument,
that might cause a compiler crash when attempting
to inline a reference to a procedure within a
program unit.
(The diagnostics themselves are still produced, but
as warnings, unless @option{-Wno-globals} is specified,
in which case no relevant diagnostics are produced.)
Further, this option disables such inlining, to
avoid compiler crashes resulting from incorrect
code that would otherwise be diagnosed.
As such, this option might be quite useful when
compiling existing, ``working'' code that happens
to have a few bugs that do not generally show themselves,
but which @command{g77} diagnoses.
Use of this option therefore has the effect of
instructing @command{g77} to behave more like it did
up through version 0.5.19.1, when it paid little or
no attention to disagreements between program units
about a procedure's type and argument information,
and when it performed no inlining of procedures
(except statement functions).
Without this option, @command{g77} defaults to performing
the potentially inlining procedures as it started doing
in version 0.5.20, but as of version 0.5.21, it also
diagnoses disagreements that might cause such inlining
to crash the compiler as (fatal) errors,
and warns about similar disagreements
that are currently believed to not
likely to result in the compiler later crashing
or producing incorrect code.
@cindex -fflatten-arrays option
@item -fflatten-arrays
@cindex array performance
@cindex arrays, flattening
Use back end's C-like constructs
(pointer plus offset)
instead of its @code{ARRAY_REF} construct
to handle all array references.
@emph{Note:} This option is not supported.
It is intended for use only by @command{g77} developers,
to evaluate code-generation issues.
It might be removed at any time.
@cindex -fbounds-check option
@cindex -ffortran-bounds-check option
@item -fbounds-check
@itemx -ffortran-bounds-check
@cindex bounds checking
@cindex range checking
@cindex array bounds checking
@cindex subscript checking
@cindex substring checking
@cindex checking subscripts
@cindex checking substrings
Enable generation of run-time checks for array subscripts
and substring start and end points
against the (locally) declared minimum and maximum values.
The current implementation uses the @code{libf2c}
library routine @code{s_rnge} to print the diagnostic.
However, whereas @command{f2c} generates a single check per
reference for a multi-dimensional array, of the computed
offset against the valid offset range (0 through the size of the array),
@command{g77} generates a single check per @emph{subscript} expression.
This catches some cases of potential bugs that @command{f2c} does not,
such as references to below the beginning of an assumed-size array.
@command{g77} also generates checks for @code{CHARACTER} substring references,
something @command{f2c} currently does not do.
Use the new @option{-ffortran-bounds-check} option
to specify bounds-checking for only the Fortran code you are compiling,
not necessarily for code written in other languages.
@emph{Note:} To provide more detailed information on the offending subscript,
@command{g77} provides the @code{libg2c} run-time library routine @code{s_rnge}
with somewhat differently-formatted information.
Here's a sample diagnostic:
@smallexample
Subscript out of range on file line 4, procedure rnge.f/bf.
Attempt to access the -6-th element of variable b[subscript-2-of-2].
Aborted
@end smallexample
The above message indicates that the offending source line is
line 4 of the file @file{rnge.f},
within the program unit (or statement function) named @samp{bf}.
The offended array is named @samp{b}.
The offended array dimension is the second for a two-dimensional array,
and the offending, computed subscript expression was @samp{-6}.
For a @code{CHARACTER} substring reference, the second line has
this appearance:
@smallexample
Attempt to access the 11-th element of variable a[start-substring].
@end smallexample
This indicates that the offended @code{CHARACTER} variable or array
is named @samp{a},
the offended substring position is the starting (leftmost) position,
and the offending substring expression is @samp{11}.
(Though the verbage of @code{s_rnge} is not ideal
for the purpose of the @command{g77} compiler,
the above information should provide adequate diagnostic abilities
to it users.)
@end table
@xref{Code Gen Options,,Options for Code Generation Conventions,
gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
offered by the GBE
shared by @command{g77} @command{gcc} and other GNU compilers.
Some of these do @emph{not} work when compiling programs written in Fortran:
@table @gcctabopt
@cindex -fpcc-struct-return option
@cindex options, -fpcc-struct-return
@item -fpcc-struct-return
@cindex -freg-struct-return option
@cindex options, -freg-struct-return
@item -freg-struct-return
You should not use these except strictly the same way as you
used them to build the version of @code{libg2c} with which
you will be linking all code compiled by @command{g77} with the
same option.
@cindex -fshort-double option
@cindex options, -fshort-double
@item -fshort-double
This probably either has no effect on Fortran programs, or
makes them act loopy.
@cindex -fno-common option
@cindex options, -fno-common
@item -fno-common
Do not use this when compiling Fortran programs,
or there will be Trouble.
@cindex -fpack-struct option
@cindex options, -fpack-struct
@item -fpack-struct
This probably will break any calls to the @code{libg2c} library,
at the very least, even if it is built with the same option.
@end table
@c man end
@node Environment Variables
@section Environment Variables Affecting GNU Fortran
@cindex environment variables
@c man begin ENVIRONMENT
GNU Fortran currently does not make use of any environment
variables to control its operation above and beyond those
that affect the operation of @command{gcc}.
@xref{Environment Variables,,Environment Variables Affecting GCC,
gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
variables.
@c man end
|