aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.2.1/gcc/doc/gfortran.1
blob: 8e3529151eea2091305224f7167ac2f25aea873e (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
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "GFORTRAN 1"
.TH GFORTRAN 1 "2007-07-19" "gcc-4.2.1" "GNU"
.SH "NAME"
gfortran \- GNU Fortran compiler
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
gfortran [\fB\-c\fR|\fB\-S\fR|\fB\-E\fR]
         [\fB\-g\fR] [\fB\-pg\fR] [\fB\-O\fR\fIlevel\fR]
         [\fB\-W\fR\fIwarn\fR...] [\fB\-pedantic\fR]
         [\fB\-I\fR\fIdir\fR...] [\fB\-L\fR\fIdir\fR...]
         [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
         [\fB\-f\fR\fIoption\fR...]
	 [\fB\-m\fR\fImachine-option\fR...]
         [\fB\-o\fR \fIoutfile\fR] \fIinfile\fR...
.PP
Only the most useful options are listed here; see below for the
remainder.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBgfortran\fR command supports all the options supported by the
\&\fBgcc\fR command.  Only options specific to \s-1GNU\s0 Fortran are documented here.
.PP
All \s-1GCC\s0 and \s-1GNU\s0 Fortran options
are accepted both by \fBgfortran\fR and by \fBgcc\fR
(as well as any other drivers built at the same time,
such as \fBg++\fR),
since adding \s-1GNU\s0 Fortran to the \s-1GCC\s0 distribution
enables acceptance of \s-1GNU\s0 Fortran options
by all of the relevant drivers.
.PP
In some cases, options have positive and negative forms;
the negative form of \fB\-ffoo\fR would be \fB\-fno\-foo\fR.
This manual documents only one of these two forms, whichever
one is not the default.
.SH "OPTIONS"
.IX Header "OPTIONS"
Here is a summary of all the options specific to \s-1GNU\s0 Fortran, grouped
by type.  Explanations are in the following sections.
.IP "\fIFortran Language Options\fR" 4
.IX Item "Fortran Language Options"
\&\fB\-fall\-intrinsics  \-ffree\-form  \-fno\-fixed\-form 
\&\-fdollar\-ok  \-fimplicit\-none  \-fmax\-identifier\-length 
\&\-std=\fR\fIstd\fR \fB\-fd\-lines\-as\-code  \-fd\-lines\-as\-comments 
\&\-ffixed\-line\-length\-\fR\fIn\fR  \fB\-ffixed\-line\-length\-none 
\&\-ffree\-line\-length\-\fR\fIn\fR  \fB\-ffree\-line\-length\-none 
\&\-fdefault\-double\-8  \-fdefault\-integer\-8  \-fdefault\-real\-8 
\&\-fcray\-pointer  \-fopenmp  \-frange\-check \-fno\-backslash\fR 
.IP "\fIError and Warning Options\fR" 4
.IX Item "Error and Warning Options"
\&\fB\-fmax\-errors=\fR\fIn\fR 
\&\fB\-fsyntax\-only  \-pedantic  \-pedantic\-errors 
\&\-w  \-Wall  \-Waliasing  \-Wampersand  \-Wcharacter\-truncation  \-Wconversion 
\&\-Wimplicit\-interface  \-Wline\-truncation  \-Wnonstd\-intrinsics  \-Wsurprising 
\&\-Wno\-tabs  \-Wunderflow  \-W\fR
.IP "\fIDebugging Options\fR" 4
.IX Item "Debugging Options"
\&\fB\-fdump\-parse\-tree  \-ffpe\-trap=\fR\fIlist\fR
.IP "\fIDirectory Options\fR" 4
.IX Item "Directory Options"
\&\fB\-I\fR\fIdir\fR  \fB\-J\fR\fIdir\fR  \fB\-M\fR\fIdir\fR
.IP "\fIRuntime Options\fR" 4
.IX Item "Runtime Options"
\&\fB\-fconvert=\fR\fIconversion\fR  \fB\-frecord\-marker=\fR\fIlength\fR 
\&\fB\-fmax\-subrecord\-length=\fR\fIlength\fR
.IP "\fICode Generation Options\fR" 4
.IX Item "Code Generation Options"
\&\fB\-fno\-automatic  \-ff2c  \-fno\-underscoring
\&\-fsecond\-underscore 
\&\-fbounds\-check  \-fmax\-stack\-var\-size=\fR\fIn\fR 
\&\fB\-fpack\-derived  \-frepack\-arrays  \-fshort\-enums\fR
.Sh "Options Controlling Fortran Dialect"
.IX Subsection "Options Controlling Fortran Dialect"
The following options control the details of the Fortran dialect
accepted by the compiler:
.IP "\fB\-ffree\-form\fR" 4
.IX Item "-ffree-form"
.PD 0
.IP "\fB\-ffixed\-form\fR" 4
.IX Item "-ffixed-form"
.PD
Specify the layout used by the source file.  The free form layout
was introduced in Fortran 90.  Fixed form was traditionally used in
older Fortran programs.  When neither option is specified, the source
form is determined by the file extension.
.IP "\fB\-fall\-intrinsics\fR" 4
.IX Item "-fall-intrinsics"
Accept all of the intrinsic procedures provided in libgfortran 
without regard to the setting of \fB\-std\fR.  In particular, 
this option can be quite useful with \fB\-std=f95\fR.  Additionally,
\&\fBgfortran\fR will ignore \fB\-Wnonstd\-intrinsics\fR.
.IP "\fB\-fd\-lines\-as\-code\fR" 4
.IX Item "-fd-lines-as-code"
.PD 0
.IP "\fB\-fd\-lines\-as\-comments\fR" 4
.IX Item "-fd-lines-as-comments"
.PD
Enable special treatment for lines beginning with \f(CW\*(C`d\*(C'\fR or \f(CW\*(C`D\*(C'\fR
in fixed form sources.  If the \fB\-fd\-lines\-as\-code\fR option is
given they are treated as if the first column contained a blank.  If the
\&\fB\-fd\-lines\-as\-comments\fR option is given, they are treated as
comment lines.
.IP "\fB\-fdefault\-double\-8\fR" 4
.IX Item "-fdefault-double-8"
Set the \f(CW\*(C`DOUBLE PRECISION\*(C'\fR type to an 8 byte wide type.
.IP "\fB\-fdefault\-integer\-8\fR" 4
.IX Item "-fdefault-integer-8"
Set the default integer and logical types to an 8 byte wide type.
Do nothing if this is already the default.
.IP "\fB\-fdefault\-real\-8\fR" 4
.IX Item "-fdefault-real-8"
Set the default real type to an 8 byte wide type.
Do nothing if this is already the default.
.IP "\fB\-fdollar\-ok\fR" 4
.IX Item "-fdollar-ok"
Allow \fB$\fR as a valid character in a symbol name.
.IP "\fB\-fno\-backslash\fR" 4
.IX Item "-fno-backslash"
Change the interpretation of backslashes in string literals from
\&\*(L"C\-style\*(R" escape characters to a single backslash character.
.IP "\fB\-ffixed\-line\-length\-\fR\fIn\fR" 4
.IX Item "-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.
.Sp
Popular values for \fIn\fR include 72 (the
standard and the default), 80 (card image), and 132 (corresponding
to \*(L"extended\-source\*(R" options in some popular compilers).
\&\fIn\fR may also be \fBnone\fR, meaning that the entire line is meaningful
and that continued character constants never have implicit spaces appended
to them to fill out the line.
\&\fB\-ffixed\-line\-length\-0\fR means the same thing as
\&\fB\-ffixed\-line\-length\-none\fR.
.IP "\fB\-ffree\-line\-length\-\fR\fIn\fR" 4
.IX Item "-ffree-line-length-n"
Set column after which characters are ignored in typical free-form
lines in the source file. The default value is 132.
\&\fIn\fR may be \fBnone\fR, meaning that the entire line is meaningful.
\&\fB\-ffree\-line\-length\-0\fR means the same thing as
\&\fB\-ffree\-line\-length\-none\fR.
.IP "\fB\-fmax\-identifier\-length=\fR\fIn\fR" 4
.IX Item "-fmax-identifier-length=n"
Specify the maximum allowed identifier length. Typical values are
31 (Fortran 95) and 63 (Fortran 2003).
.IP "\fB\-fimplicit\-none\fR" 4
.IX Item "-fimplicit-none"
Specify that no implicit typing is allowed, unless overridden by explicit
\&\f(CW\*(C`IMPLICIT\*(C'\fR statements.  This is the equivalent of adding
\&\f(CW\*(C`implicit none\*(C'\fR to the start of every procedure.
.IP "\fB\-fcray\-pointer\fR" 4
.IX Item "-fcray-pointer"
Enable the Cray pointer extension, which provides C\-like pointer
functionality.
.IP "\fB\-fopenmp\fR" 4
.IX Item "-fopenmp"
Enable the OpenMP extensions.  This includes OpenMP \f(CW\*(C`!$omp\*(C'\fR directives
in free form
and \f(CW\*(C`c$omp\*(C'\fR, \f(CW*$omp\fR and \f(CW\*(C`!$omp\*(C'\fR directives in fixed form,
\&\f(CW\*(C`!$\*(C'\fR conditional compilation sentinels in free form
and \f(CW\*(C`c$\*(C'\fR, \f(CW\*(C`*$\*(C'\fR and \f(CW\*(C`!$\*(C'\fR sentinels in fixed form, 
and when linking arranges for the OpenMP runtime library to be linked
in.
.IP "\fB\-frange\-check\fR" 4
.IX Item "-frange-check"
Enable range checking on results of simplification of constant
expressions during compilation.  For example, by default, \s-1GNU\s0 Fortran
will give an overflow error at compile time when simplifying \f(CW\*(C`a =
EXP(1000)\*(C'\fR. With \fB\-fno\-range\-check\fR, no error will be given and
the variable \f(CW\*(C`a\*(C'\fR will be assigned the value \f(CW\*(C`+Infinity\*(C'\fR.
Similarly, \f(CW\*(C`DATA i/Z'FFFFFFFF'/\*(C'\fR will result in an integer overflow
on most systems, but with \fB\-fno\-range\-check\fR the value will
\&\*(L"wrap around\*(R" and \f(CW\*(C`i\*(C'\fR will be initialized to \-1 instead.
.IP "\fB\-std=\fR\fIstd\fR" 4
.IX Item "-std=std"
Specify the standard to which the program is expected to conform, which
may be one of \fBf95\fR, \fBf2003\fR, \fBgnu\fR, or \fBlegacy\fR.
The default value for \fIstd\fR is \fBgnu\fR, which specifies a
superset of the Fortran 95 standard that includes all of the extensions
supported by \s-1GNU\s0 Fortran, although warnings will be given for obsolete
extensions not recommended for use in new code.  The \fBlegacy\fR value
is equivalent but without the warnings for obsolete extensions, and may
be useful for old non-standard programs.  The \fBf95\fR and
\&\fBf2003\fR values specify strict conformance to the Fortran 95 and
Fortran 2003 standards, respectively; errors are given for all
extensions beyond the relevant language standard, and warnings are given
for the Fortran 77 features that are permitted but obsolescent in later
standards.
.Sh "Options to Request or Suppress Errors and Warnings"
.IX Subsection "Options to Request or Suppress Errors and Warnings"
Errors are diagnostic messages that report that the \s-1GNU\s0 Fortran compiler
cannot compile the relevant piece of source code.  The compiler will
continue to process the program in an attempt to report further errors
to aid in debugging, but will not produce any compiled output.  
.PP
Warnings are diagnostic messages that report constructions which
are not inherently erroneous but which are risky or suggest there is
likely to be a bug in the program.  Unless \fB\-Werror\fR is specified,
they do not prevent compilation of the program.
.PP
You can request many specific warnings with options beginning \fB\-W\fR,
for example \fB\-Wimplicit\fR to request warnings on implicit
declarations.  Each of these specific warning options also has a
negative form beginning \fB\-Wno\-\fR to turn off warnings;
for example, \fB\-Wno\-implicit\fR.  This manual lists only one of the
two forms, whichever is not the default.
.PP
These options control the amount and kinds of errors and warnings produced
by \s-1GNU\s0 Fortran:
.IP "\fB\-fmax\-errors\-\fR\fIn\fR" 4
.IX Item "-fmax-errors-n"
Limits the maximum number of error messages to \fIn\fR, at which point
\&\s-1GNU\s0 Fortran bails out rather than attempting to continue processing the
source code.  If \fIn\fR is 0, there is no limit on the number of error
messages produced.
.IP "\fB\-fsyntax\-only\fR" 4
.IX Item "-fsyntax-only"
Check the code for syntax errors, but don't do anything beyond that.
.IP "\fB\-pedantic\fR" 4
.IX Item "-pedantic"
Issue warnings for uses of extensions to Fortran 95.
\&\fB\-pedantic\fR also applies to C\-language constructs where they
occur in \s-1GNU\s0 Fortran source files, such as use of \fB\ee\fR in a
character constant within a directive like \f(CW\*(C`#include\*(C'\fR.
.Sp
Valid Fortran 95 programs should compile properly with or without
this option.
However, without this option, certain \s-1GNU\s0 extensions and traditional
Fortran features are supported as well.
With this option, many of them are rejected.
.Sp
Some users try to use \fB\-pedantic\fR to check programs for conformance.
They soon find that it does not do quite what they want\-\-\-it finds some
nonstandard practices, but not all.
However, improvements to \s-1GNU\s0 Fortran in this area are welcome.
.Sp
This should be used in conjunction with \fB\-std=f95\fR or
\&\fB\-std=f2003\fR.
.IP "\fB\-pedantic\-errors\fR" 4
.IX Item "-pedantic-errors"
Like \fB\-pedantic\fR, except that errors are produced rather than
warnings.
.IP "\fB\-w\fR" 4
.IX Item "-w"
Inhibit all warning messages.
.IP "\fB\-Wall\fR" 4
.IX Item "-Wall"
Enables commonly used warning options pertaining to usage that
we recommend avoiding and that we believe are easy to avoid.
This currently includes \fB\-Waliasing\fR,
\&\fB\-Wampersand\fR, \fB\-Wsurprising\fR, \fB\-Wnonstd\-intrinsics\fR,
\&\fB\-Wno\-tabs\fR, and \fB\-Wline\-truncation\fR.
.IP "\fB\-Waliasing\fR" 4
.IX Item "-Waliasing"
Warn about possible aliasing of dummy arguments. Specifically, it warns
if the same actual argument is associated with a dummy argument with
\&\f(CW\*(C`INTENT(IN)\*(C'\fR and a dummy argument with \f(CW\*(C`INTENT(OUT)\*(C'\fR in a call
with an explicit interface.
.Sp
The following example will trigger the warning.
.Sp
.Vb 7
\&          interface
\&            subroutine bar(a,b)
\&              integer, intent(in) :: a
\&              integer, intent(out) :: b
\&            end subroutine
\&          end interface
\&          integer :: a
.Ve
.Sp
.Vb 1
\&          call bar(a,a)
.Ve
.IP "\fB\-Wampersand\fR" 4
.IX Item "-Wampersand"
Warn about missing ampersand in continued character constants. The warning is
given with \fB\-Wampersand\fR, \fB\-pedantic\fR, \fB\-std=f95\fR, and
\&\fB\-std=f2003\fR. Note: With no ampersand given in a continued character
constant, \s-1GNU\s0 Fortran assumes continuation at the first non\-comment,
non-whitespace character after the ampersand that initiated the continuation.
.IP "\fB\-Wcharacter\-truncation\fR" 4
.IX Item "-Wcharacter-truncation"
Warn when a character assignment will truncate the assigned string.
.IP "\fB\-Wconversion\fR" 4
.IX Item "-Wconversion"
Warn about implicit conversions between different types.
.IP "\fB\-Wimplicit\-interface\fR" 4
.IX Item "-Wimplicit-interface"
Warn if a procedure is called without an explicit interface.
Note this only checks that an explicit interface is present.  It does not
check that the declared interfaces are consistent across program units.
.IP "\fB\-Wnonstd\-intrinsics\fR" 4
.IX Item "-Wnonstd-intrinsics"
Warn if the user tries to use an intrinsic that does not belong to the 
standard the user has chosen via the \fB\-std\fR option.
.IP "\fB\-Wsurprising\fR" 4
.IX Item "-Wsurprising"
Produce a warning when \*(L"suspicious\*(R" code constructs are encountered.
While technically legal these usually indicate that an error has been made.
.Sp
This currently produces a warning under the following circumstances:
.RS 4
.IP "*" 4
An \s-1INTEGER\s0 \s-1SELECT\s0 construct has a \s-1CASE\s0 that can never be matched as its
lower value is greater than its upper value.
.IP "*" 4
A \s-1LOGICAL\s0 \s-1SELECT\s0 construct has three \s-1CASE\s0 statements.
.RE
.RS 4
.RE
.IP "\fB\-Wtabs\fR" 4
.IX Item "-Wtabs"
By default, tabs are accepted as whitespace, but tabs are not members
of the Fortran Character Set.  \fB\-Wno\-tabs\fR will cause a warning
to be issued if a tab is encountered. Note, \fB\-Wno\-tabs\fR is active
for \fB\-pedantic\fR, \fB\-std=f95\fR, \fB\-std=f2003\fR, and
\&\fB\-Wall\fR.
.IP "\fB\-Wunderflow\fR" 4
.IX Item "-Wunderflow"
Produce a warning when numerical constant expressions are
encountered, which yield an \s-1UNDERFLOW\s0 during compilation.
.IP "\fB\-Werror\fR" 4
.IX Item "-Werror"
Turns all warnings into errors.
.IP "\fB\-W\fR" 4
.IX Item "-W"
Turns on \*(L"extra warnings\*(R" and, if optimization is specified
via \fB\-O\fR, the \fB\-Wuninitialized\fR option.
(This might change in future versions of \s-1GNU\s0 Fortran.)
.PP
Some of these have no effect when compiling programs written in Fortran.
.Sh "Options for Debugging Your Program or \s-1GNU\s0 Fortran"
.IX Subsection "Options for Debugging Your Program or GNU Fortran"
\&\s-1GNU\s0 Fortran has various special options that are used for debugging
either your program or the \s-1GNU\s0 Fortran compiler.
.IP "\fB\-fdump\-parse\-tree\fR" 4
.IX Item "-fdump-parse-tree"
Output the internal parse tree before starting code generation.  Only
really useful for debugging the \s-1GNU\s0 Fortran compiler itself.
.IP "\fB\-ffpe\-trap=\fR\fIlist\fR" 4
.IX Item "-ffpe-trap=list"
Specify a list of \s-1IEEE\s0 exceptions when a Floating Point Exception
(\s-1FPE\s0) should be raised.  On most systems, this will result in a \s-1SIGFPE\s0
signal being sent and the program being interrupted, producing a core
file useful for debugging.  \fIlist\fR is a (possibly empty) comma-separated
list of the following \s-1IEEE\s0 exceptions: \fBinvalid\fR (invalid floating
point operation, such as \f(CW\*(C`SQRT(\-1.0)\*(C'\fR), \fBzero\fR (division by
zero), \fBoverflow\fR (overflow in a floating point operation),
\&\fBunderflow\fR (underflow in a floating point operation),
\&\fBprecision\fR (loss of precision during operation) and \fBdenormal\fR
(operation produced a denormal value).
.Sh "Options for Directory Search"
.IX Subsection "Options for Directory Search"
These options affect how \s-1GNU\s0 Fortran searches
for files specified by the \f(CW\*(C`INCLUDE\*(C'\fR directive and where it searches
for previously compiled modules.
.PP
It also affects the search paths used by \fBcpp\fR when used to preprocess
Fortran source.
.IP "\fB\-I\fR\fIdir\fR" 4
.IX Item "-Idir"
These affect interpretation of the \f(CW\*(C`INCLUDE\*(C'\fR directive
(as well as of the \f(CW\*(C`#include\*(C'\fR directive of the \fBcpp\fR
preprocessor).
.Sp
Also note that the general behavior of \fB\-I\fR and
\&\f(CW\*(C`INCLUDE\*(C'\fR is pretty much the same as of \fB\-I\fR with
\&\f(CW\*(C`#include\*(C'\fR in the \fBcpp\fR preprocessor, with regard to
looking for \fIheader.gcc\fR files and other such things.
.Sp
This path is also used to search for \fI.mod\fR files when previously
compiled modules are required by a \f(CW\*(C`USE\*(C'\fR statement.
.IP "\fB\-M\fR\fIdir\fR" 4
.IX Item "-Mdir"
.PD 0
.IP "\fB\-J\fR\fIdir\fR" 4
.IX Item "-Jdir"
.PD
This option specifies where to put \fI.mod\fR files for compiled modules.
It is also added to the list of directories to searched by an \f(CW\*(C`USE\*(C'\fR
statement.
.Sp
The default is the current directory.
.Sp
\&\fB\-J\fR is an alias for \fB\-M\fR to avoid conflicts with existing
\&\s-1GCC\s0 options.
.Sh "Influencing runtime behavior"
.IX Subsection "Influencing runtime behavior"
These options affect the runtime behavior of programs compiled with \s-1GNU\s0 Fortran.
.IP "\fB\-fconvert=\fR\fIconversion\fR" 4
.IX Item "-fconvert=conversion"
Specify the representation of data for unformatted files.  Valid
values for conversion are: \fBnative\fR, the default; \fBswap\fR,
swap between big\- and little\-endian; \fBbig-endian\fR, use big-endian
representation for unformatted files; \fBlittle-endian\fR, use little-endian
representation for unformatted files.
.Sp
\&\fIThis option has an effect only when used in the main program.
The \f(CI\*(C`CONVERT\*(C'\fI specifier and the \s-1GFORTRAN_CONVERT_UNIT\s0 environment
variable override the default specified by \f(BI\-fconvert\fI.\fR
.IP "\fB\-frecord\-marker=\fR\fIlength\fR" 4
.IX Item "-frecord-marker=length"
Specify the length of record markers for unformatted files.
Valid values for \fIlength\fR are 4 and 8.  Default is 4.
\&\fIThis is different from previous versions of gfortran\fR,
which specified a default record marker length of 8 on most
systems.  If you want to read or write files compatible
with earlier versions of gfortran, use \fB\-frecord\-marker=8\fR.
.IP "\fB\-fmax\-subrecord\-length=\fR\fIlength\fR" 4
.IX Item "-fmax-subrecord-length=length"
Specify the maximum length for a subrecord.  The maximum permitted
value for length is 2147483639, which is also the default.  Only
really useful for use by the gfortran testsuite.
.Sh "Options for Code Generation Conventions"
.IX Subsection "Options for Code Generation Conventions"
These machine-independent options control the interface conventions
used in code generation.
.PP
Most of them have both positive and negative forms; the negative form
of \fB\-ffoo\fR would be \fB\-fno\-foo\fR.  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 \fBno\-\fR or adding
it.
.IP "\fB\-fno\-automatic\fR" 4
.IX Item "-fno-automatic"
Treat each program unit as if the \f(CW\*(C`SAVE\*(C'\fR 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
\&\fB\-static\fR.)
.IP "\fB\-ff2c\fR" 4
.IX Item "-ff2c"
Generate code designed to be compatible with code generated
by \fBg77\fR and \fBf2c\fR.
.Sp
The calling conventions used by \fBg77\fR (originally implemented
in \fBf2c\fR) require functions that return type
default \f(CW\*(C`REAL\*(C'\fR to actually return the C type \f(CW\*(C`double\*(C'\fR, and
functions that return type \f(CW\*(C`COMPLEX\*(C'\fR to return the values via an
extra argument in the calling sequence that points to where to
store the return value.  Under the default \s-1GNU\s0 calling conventions, such
functions simply return their results as they would in \s-1GNU\s0
C\-\-\-default \f(CW\*(C`REAL\*(C'\fR functions return the C type \f(CW\*(C`float\*(C'\fR, and
\&\f(CW\*(C`COMPLEX\*(C'\fR functions return the \s-1GNU\s0 C type \f(CW\*(C`complex\*(C'\fR.
Additionally, this option implies the \fB\-fsecond\-underscore\fR
option, unless \fB\-fno\-second\-underscore\fR is explicitly requested.
.Sp
This does not affect the generation of code that interfaces with
the \fBlibgfortran\fR library.
.Sp
\&\fICaution:\fR It is not a good idea to mix Fortran code compiled with
\&\fB\-ff2c\fR with code compiled with the default \fB\-fno\-f2c\fR
calling conventions as, calling \f(CW\*(C`COMPLEX\*(C'\fR or default \f(CW\*(C`REAL\*(C'\fR
functions between program parts which were compiled with different
calling conventions will break at execution time.
.Sp
\&\fICaution:\fR This will break code which passes intrinsic functions
of type default \f(CW\*(C`REAL\*(C'\fR or \f(CW\*(C`COMPLEX\*(C'\fR as actual arguments, as
the library implementations use the \fB\-fno\-f2c\fR calling conventions.
.IP "\fB\-fno\-underscoring\fR" 4
.IX Item "-fno-underscoring"
Do not transform names of entities specified in the Fortran
source file by appending underscores to them.
.Sp
With \fB\-funderscoring\fR in effect, \s-1GNU\s0 Fortran appends one
underscore to external names with no underscores.  This is done to ensure
compatibility with code produced by many \s-1UNIX\s0 Fortran compilers.
.Sp
\&\fICaution\fR: The default behavior of \s-1GNU\s0 Fortran is
incompatible with \fBf2c\fR and \fBg77\fR, please use the
\&\fB\-ff2c\fR option if you want object files compiled with
\&\s-1GNU\s0 Fortran to be compatible with object code created with these
tools.
.Sp
Use of \fB\-fno\-underscoring\fR is not recommended unless you are
experimenting with issues such as integration of \s-1GNU\s0 Fortran into
existing system environments (vis\-a\-vis existing libraries, tools, and
so on).
.Sp
For example, with \fB\-funderscoring\fR, and assuming other defaults like
\&\fB\-fcase\-lower\fR and that \f(CW\*(C`j()\*(C'\fR and \f(CW\*(C`max_count()\*(C'\fR are
external functions while \f(CW\*(C`my_var\*(C'\fR and \f(CW\*(C`lvar\*(C'\fR are local variables,
a statement like
.Sp
.Vb 1
\&        I = J() + MAX_COUNT (MY_VAR, LVAR)
.Ve
.Sp
is implemented as something akin to:
.Sp
.Vb 1
\&        i = j_() + max_count__(&my_var__, &lvar);
.Ve
.Sp
With \fB\-fno\-underscoring\fR, the same statement is implemented as:
.Sp
.Vb 1
\&        i = j() + max_count(&my_var, &lvar);
.Ve
.Sp
Use of \fB\-fno\-underscoring\fR allows direct specification of
user-defined names while debugging and when interfacing \s-1GNU\s0 Fortran
code with other languages.
.Sp
Note that just because the names match does \fInot\fR mean that the
interface implemented by \s-1GNU\s0 Fortran for an external name matches the
interface implemented by some other language for that same name.
That is, getting code produced by \s-1GNU\s0 Fortran 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.
.Sp
Also, note that with \fB\-fno\-underscoring\fR, 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.
.Sp
In future versions of \s-1GNU\s0 Fortran 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.
.IP "\fB\-fsecond\-underscore\fR" 4
.IX Item "-fsecond-underscore"
By default, \s-1GNU\s0 Fortran appends an underscore to external
names.  If this option is used \s-1GNU\s0 Fortran appends two
underscores to names with underscores and one underscore to external names
with no underscores.  \s-1GNU\s0 Fortran also appends two underscores to
internal names with underscores to avoid naming collisions with external
names.
.Sp
This option has no effect if \fB\-fno\-underscoring\fR is
in effect.  It is implied by the \fB\-ff2c\fR option.
.Sp
Otherwise, with this option, an external name such as \f(CW\*(C`MAX_COUNT\*(C'\fR
is implemented as a reference to the link-time external symbol
\&\f(CW\*(C`max_count_\|_\*(C'\fR, instead of \f(CW\*(C`max_count_\*(C'\fR.  This is required
for compatibility with \fBg77\fR and \fBf2c\fR, and is implied
by use of the \fB\-ff2c\fR option.
.IP "\fB\-fbounds\-check\fR" 4
.IX Item "-fbounds-check"
Enable generation of run-time checks for array subscripts
and against the declared minimum and maximum values.  It also
checks array indices for assumed and deferred
shape arrays against the actual allocated bounds.
.Sp
In the future this may also include other forms of checking, e.g., checking
substring references.
.IP "\fB\-fmax\-stack\-var\-size=\fR\fIn\fR" 4
.IX Item "-fmax-stack-var-size=n"
This option specifies the size in bytes of the largest array that will be put
on the stack.
.Sp
This option currently only affects local arrays declared with constant
bounds, and may not apply to all character variables.
Future versions of \s-1GNU\s0 Fortran may improve this behavior.
.Sp
The default value for \fIn\fR is 32768.
.IP "\fB\-fpack\-derived\fR" 4
.IX Item "-fpack-derived"
This option tells \s-1GNU\s0 Fortran to pack derived type members as closely as
possible.  Code compiled with this option is likely to be incompatible
with code compiled without this option, and may execute slower.
.IP "\fB\-frepack\-arrays\fR" 4
.IX Item "-frepack-arrays"
In some circumstances \s-1GNU\s0 Fortran may pass assumed shape array
sections via a descriptor describing a noncontiguous area of memory.
This option adds code to the function prologue to repack the data into
a contiguous block at runtime.
.Sp
This should result in faster accesses to the array.  However it can introduce
significant overhead to the function call, especially  when the passed data
is noncontiguous.
.IP "\fB\-fshort\-enums\fR" 4
.IX Item "-fshort-enums"
This option is provided for interoperability with C code that was
compiled with the \fB\-fshort\-enums\fR option.  It will make
\&\s-1GNU\s0 Fortran choose the smallest \f(CW\*(C`INTEGER\*(C'\fR kind a given
enumerator set will fit in, and give all its enumerators this kind.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
The \fBgfortran\fR compiler currently does not make use of any environment
variables to control its operation above and beyond those
that affect the operation of \fBgcc\fR.
.SH "BUGS"
.IX Header "BUGS"
For instructions on reporting bugs, see
<\fBhttp://gcc.gnu.org/bugs.html\fR>.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf\-funding\fR\|(7),
\&\fIcpp\fR\|(1), \fIgcov\fR\|(1), \fIgcc\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), \fIgdb\fR\|(1), \fIadb\fR\|(1), \fIdbx\fR\|(1), \fIsdb\fR\|(1)
and the Info entries for \fIgcc\fR, \fIcpp\fR, \fIgfortran\fR, \fIas\fR,
\&\fIld\fR, \fIbinutils\fR and \fIgdb\fR.
.SH "AUTHOR"
.IX Header "AUTHOR"
See the Info entry for \fBgfortran\fR for contributors to \s-1GCC\s0 and
\&\s-1GNU\s0 Fortran.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
.PP
Permission is granted to copy, distribute and/or modify this document
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being \*(L"\s-1GNU\s0 General Public License\*(R" and \*(L"Funding
Free Software\*(R", 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 \fIgfdl\fR\|(7) man page.
.PP
(a) The \s-1FSF\s0's Front-Cover Text is:
.PP
.Vb 1
\&     A GNU Manual
.Ve
.PP
(b) The \s-1FSF\s0's Back-Cover Text is:
.PP
.Vb 3
\&     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.
.Ve