1GFORTRAN(1)                           GNU                          GFORTRAN(1)
2
3
4

NAME

6       gfortran - GNU Fortran compiler
7

SYNOPSIS

9       gfortran [-c|-S|-E]
10                [-g] [-pg] [-Olevel]
11                [-Wwarn...] [-pedantic]
12                [-Idir...] [-Ldir...]
13                [-Dmacro[=defn]...] [-Umacro]
14                [-foption...]
15                [-mmachine-option...]
16                [-o outfile] infile...
17
18       Only the most useful options are listed here; see below for the
19       remainder.
20

DESCRIPTION

22       The gfortran command supports all the options supported by the gcc
23       command.  Only options specific to GNU Fortran are documented here.
24
25       All GCC and GNU Fortran options are accepted both by gfortran and by
26       gcc (as well as any other drivers built at the same time, such as g++),
27       since adding GNU Fortran to the GCC distribution enables acceptance of
28       GNU Fortran options by all of the relevant drivers.
29
30       In some cases, options have positive and negative forms; the negative
31       form of -ffoo would be -fno-foo.  This manual documents only one of
32       these two forms, whichever one is not the default.
33

OPTIONS

35       Here is a summary of all the options specific to GNU Fortran, grouped
36       by type.  Explanations are in the following sections.
37
38       Fortran Language Options
39           -fall-intrinsics  -ffree-form  -fno-fixed-form -fdollar-ok
40           -fimplicit-none  -fmax-identifier-length -std=std -fd-lines-as-code
41           -fd-lines-as-comments -ffixed-line-length-n
42           -ffixed-line-length-none -ffree-line-length-n
43           -ffree-line-length-none -fdefault-double-8  -fdefault-integer-8
44           -fdefault-real-8 -fcray-pointer  -fopenmp  -fno-range-check
45           -fbackslash -fmodule-private
46
47       Preprocessing Options
48           -cpp -dD -dI -dM -dN -dU -fworking-directory -imultilib dir
49           -iprefix file -isysroot dir -iquote -isystem dir -nocpp -nostdinc
50           -undef -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn]
51           -Umacro -H -P
52
53       Error and Warning Options
54           -fmax-errors=n -fsyntax-only  -pedantic  -pedantic-errors -Wall
55           -Waliasing  -Wampersand  -Warray-bounds -Wcharacter-truncation
56           -Wconversion -Wimplicit-interface  -Wimplicit-procedure
57           -Wline-truncation -Wintrinsics-std  -Wsurprising  -Wno-tabs
58           -Wunderflow  -Wunused-parameter -Wintrinsics-shadow
59           -Wno-align-commons
60
61       Debugging Options
62           -fdump-parse-tree  -ffpe-trap=list -fdump-core -fbacktrace
63
64       Directory Options
65           -Idir  -Jdir  -Mdir -fintrinsic-modules-path dir
66
67       Link Options
68           -static-libgfortran
69
70       Runtime Options
71           -fconvert=conversion  -fno-range-check -frecord-marker=length
72           -fmax-subrecord-length=length -fsign-zero
73
74       Code Generation Options
75           -fno-automatic  -ff2c  -fno-underscoring -fwhole-file
76           -fsecond-underscore -fbounds-check -fcheck-array-temporaries
77           -fmax-array-constructor =n
78           -fcheck=<all|array-temps|bounds|do|mem|pointer|recursion>
79           -fmax-stack-var-size=n -fpack-derived  -frepack-arrays
80           -fshort-enums  -fexternal-blas -fblas-matmul-limit=n -frecursive
81           -finit-local-zero -finit-integer=n
82           -finit-real=<zero|inf|-inf|nan|snan> -finit-logical=<true|false>
83           -finit-character=n -fno-align-commons -fno-protect-parens
84
85   Options controlling Fortran dialect
86       The following options control the details of the Fortran dialect
87       accepted by the compiler:
88
89       -ffree-form
90       -ffixed-form
91           Specify the layout used by the source file.  The free form layout
92           was introduced in Fortran 90.  Fixed form was traditionally used in
93           older Fortran programs.  When neither option is specified, the
94           source form is determined by the file extension.
95
96       -fall-intrinsics
97           This option causes all intrinsic procedures (including the GNU-
98           specific extensions) to be accepted.  This can be useful with
99           -std=f95 to force standard-compliance but get access to the full
100           range of intrinsics available with gfortran.  As a consequence,
101           -Wintrinsics-std will be ignored and no user-defined procedure with
102           the same name as any intrinsic will be called except when it is
103           explicitly declared "EXTERNAL".
104
105       -fd-lines-as-code
106       -fd-lines-as-comments
107           Enable special treatment for lines beginning with "d" or "D" in
108           fixed form sources.  If the -fd-lines-as-code option is given they
109           are treated as if the first column contained a blank.  If the
110           -fd-lines-as-comments option is given, they are treated as comment
111           lines.
112
113       -fdefault-double-8
114           Set the "DOUBLE PRECISION" type to an 8 byte wide type.  If
115           -fdefault-real-8 is given, "DOUBLE PRECISION" would instead be
116           promoted to 16 bytes if possible, and -fdefault-double-8 can be
117           used to prevent this.  The kind of real constants like "1.d0" will
118           not be changed by -fdefault-real-8 though, so also
119           -fdefault-double-8 does not affect it.
120
121       -fdefault-integer-8
122           Set the default integer and logical types to an 8 byte wide type.
123           Do nothing if this is already the default.  This option also
124           affects the kind of integer constants like 42.
125
126       -fdefault-real-8
127           Set the default real type to an 8 byte wide type.  Do nothing if
128           this is already the default.  This option also affects the kind of
129           non-double real constants like 1.0, and does promote the default
130           width of "DOUBLE PRECISION" to 16 bytes if possible, unless
131           "-fdefault-double-8" is given, too.
132
133       -fdollar-ok
134           Allow $ as a valid non-first character in a symbol name. Symbols
135           that start with $ are rejected since it is unclear which rules to
136           apply to implicit typing as different vendors implement different
137           rules.  Using $ in "IMPLICIT" statements is also rejected.
138
139       -fbackslash
140           Change the interpretation of backslashes in string literals from a
141           single backslash character to "C-style" escape characters. The
142           following combinations are expanded "\a", "\b", "\f", "\n", "\r",
143           "\t", "\v", "\\", and "\0" to the ASCII characters alert,
144           backspace, form feed, newline, carriage return, horizontal tab,
145           vertical tab, backslash, and NUL, respectively.  Additionally,
146           "\x"nn, "\u"nnnn and "\U"nnnnnnnn (where each n is a hexadecimal
147           digit) are translated into the Unicode characters corresponding to
148           the specified code points. All other combinations of a character
149           preceded by \ are unexpanded.
150
151       -fmodule-private
152           Set the default accessibility of module entities to "PRIVATE".
153           Use-associated entities will not be accessible unless they are
154           explicitly declared as "PUBLIC".
155
156       -ffixed-line-length-n
157           Set column after which characters are ignored in typical fixed-form
158           lines in the source file, and through which spaces are assumed (as
159           if padded to that length) after the ends of short fixed-form lines.
160
161           Popular values for n include 72 (the standard and the default), 80
162           (card image), and 132 (corresponding to "extended-source" options
163           in some popular compilers).  n may also be none, meaning that the
164           entire line is meaningful and that continued character constants
165           never have implicit spaces appended to them to fill out the line.
166           -ffixed-line-length-0 means the same thing as
167           -ffixed-line-length-none.
168
169       -ffree-line-length-n
170           Set column after which characters are ignored in typical free-form
171           lines in the source file. The default value is 132.  n may be none,
172           meaning that the entire line is meaningful.  -ffree-line-length-0
173           means the same thing as -ffree-line-length-none.
174
175       -fmax-identifier-length=n
176           Specify the maximum allowed identifier length. Typical values are
177           31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
178
179       -fimplicit-none
180           Specify that no implicit typing is allowed, unless overridden by
181           explicit "IMPLICIT" statements.  This is the equivalent of adding
182           "implicit none" to the start of every procedure.
183
184       -fcray-pointer
185           Enable the Cray pointer extension, which provides C-like pointer
186           functionality.
187
188       -fopenmp
189           Enable the OpenMP extensions.  This includes OpenMP "!$omp"
190           directives in free form and "c$omp", *$omp and "!$omp" directives
191           in fixed form, "!$" conditional compilation sentinels in free form
192           and "c$", "*$" and "!$" sentinels in fixed form, and when linking
193           arranges for the OpenMP runtime library to be linked in.  The
194           option -fopenmp implies -frecursive.
195
196       -fno-range-check
197           Disable range checking on results of simplification of constant
198           expressions during compilation.  For example, GNU Fortran will give
199           an error at compile time when simplifying "a = 1. / 0".  With this
200           option, no error will be given and "a" will be assigned the value
201           "+Infinity".  If an expression evaluates to a value outside of the
202           relevant range of ["-HUGE()":"HUGE()"], then the expression will be
203           replaced by "-Inf" or "+Inf" as appropriate.  Similarly, "DATA
204           i/Z'FFFFFFFF'/" will result in an integer overflow on most systems,
205           but with -fno-range-check the value will "wrap around" and "i" will
206           be initialized to -1 instead.
207
208       -std=std
209           Specify the standard to which the program is expected to conform,
210           which may be one of f95, f2003, f2008, gnu, or legacy.  The default
211           value for std is gnu, which specifies a superset of the Fortran 95
212           standard that includes all of the extensions supported by GNU
213           Fortran, although warnings will be given for obsolete extensions
214           not recommended for use in new code.  The legacy value is
215           equivalent but without the warnings for obsolete extensions, and
216           may be useful for old non-standard programs.  The f95, f2003 and
217           f2008 values specify strict conformance to the Fortran 95, Fortran
218           2003 and Fortran 2008 standards, respectively; errors are given for
219           all extensions beyond the relevant language standard, and warnings
220           are given for the Fortran 77 features that are permitted but
221           obsolescent in later standards.
222
223   Enable and customize preprocessing
224       Preprocessor related options. See section Preprocessing and conditional
225       compilation for more detailed information on preprocessing in gfortran.
226
227       -cpp
228       -nocpp
229           Enable preprocessing. The preprocessor is automatically invoked if
230           the file extension is .fpp, .FPP,  .F, .FOR, .FTN, .F90, .F95, .F03
231           or .F08. Use this option to manually enable preprocessing of any
232           kind of Fortran file.
233
234           To disable preprocessing of files with any of the above listed
235           extensions, use the negative form: -nocpp.
236
237           The preprocessor is run in traditional mode, be aware that any
238           restrictions of the file-format, e.g. fixed-form line width, apply
239           for preprocessed output as well.
240
241       -dM Instead of the normal output, generate a list of '#define'
242           directives for all the macros defined during the execution of the
243           preprocessor, including predefined macros. This gives you a way of
244           finding out what is predefined in your version of the preprocessor.
245           Assuming you have no file foo.f90, the command
246
247                     touch foo.f90; gfortran -cpp -dM foo.f90
248
249           will show all the predefined macros.
250
251       -dD Like -dM except in two respects: it does not include the predefined
252           macros, and it outputs both the "#define" directives and the result
253           of preprocessing. Both kinds of output go to the standard output
254           file.
255
256       -dN Like -dD, but emit only the macro names, not their expansions.
257
258       -dU Like dD except that only macros that are expanded, or whose
259           definedness is tested in preprocessor directives, are output; the
260           output is delayed until the use or test of the macro; and '#undef'
261           directives are also output for macros tested but undefined at the
262           time.
263
264       -dI Output '#include' directives in addition to the result of
265           preprocessing.
266
267       -fworking-directory
268           Enable generation of linemarkers in the preprocessor output that
269           will let the compiler know the current working directory at the
270           time of preprocessing. When this option is enabled, the
271           preprocessor will emit, after the initial linemarker, a second
272           linemarker with the current working directory followed by two
273           slashes. GCC will use this directory, when it's present in the
274           preprocessed input, as the directory emitted as the current working
275           directory in some debugging information formats.  This option is
276           implicitly enabled if debugging information is enabled, but this
277           can be inhibited with the negated form -fno-working-directory. If
278           the -P flag is present in the command line, this option has no
279           effect, since no "#line" directives are emitted whatsoever.
280
281       -idirafter dir
282           Search dir for include files, but do it after all directories
283           specified with -I and the standard system directories have been
284           exhausted. dir is treated as a system include directory.  If dir
285           begins with "=", then the "=" will be replaced by the sysroot
286           prefix; see --sysroot and -isysroot.
287
288       -imultilib dir
289           Use dir as a subdirectory of the directory containing target-
290           specific C++ headers.
291
292       -iprefix prefix
293           Specify prefix as the prefix for subsequent -iwithprefix options.
294           If the prefix represents a directory, you should include the final
295           '/'.
296
297       -isysroot dir
298           This option is like the --sysroot option, but applies only to
299           header files. See the --sysroot option for more information.
300
301       -iquote dir
302           Search dir only for header files requested with "#include "file"";
303           they are not searched for "#include <file>", before all directories
304           specified by -I and before the standard system directories. If dir
305           begins with "=", then the "=" will be replaced by the sysroot
306           prefix; see --sysroot and -isysroot.
307
308       -isystem dir
309           Search dir for header files, after all directories specified by -I
310           but before the standard system directories. Mark it as a system
311           directory, so that it gets the same special treatment as is applied
312           to the standard system directories. If dir begins with "=", then
313           the "=" will be replaced by the sysroot prefix; see --sysroot and
314           -isysroot.
315
316       -nostdinc
317           Do not search the standard system directories for header files.
318           Only the directories you have specified with -I options (and the
319           directory of the current file, if appropriate) are searched.
320
321       -undef
322           Do not predefine any system-specific or GCC-specific macros.  The
323           standard predefined macros remain defined.
324
325       -Apredicate=answer
326           Make an assertion with the predicate predicate and answer answer.
327           This form is preferred to the older form -A predicate(answer),
328           which is still supported, because it does not use shell special
329           characters.
330
331       -A-predicate=answer
332           Cancel an assertion with the predicate predicate and answer answer.
333
334       -C  Do not discard comments. All comments are passed through to the
335           output file, except for comments in processed directives, which are
336           deleted along with the directive.
337
338           You should be prepared for side effects when using -C; it causes
339           the preprocessor to treat comments as tokens in their own right.
340           For example, comments appearing at the start of what would be a
341           directive line have the effect of turning that line into an
342           ordinary source line, since the first token on the line is no
343           longer a '#'.
344
345           Warning: this currently handles C-Style comments only. The
346           preprocessor does not yet recognize Fortran-style comments.
347
348       -CC Do not discard comments, including during macro expansion. This is
349           like -C, except that comments contained within macros are also
350           passed through to the output file where the macro is expanded.
351
352           In addition to the side-effects of the -C option, the -CC option
353           causes all C++-style comments inside a macro to be converted to
354           C-style comments. This is to prevent later use of that macro from
355           inadvertently commenting out the remainder of the source line. The
356           -CC option is generally used to support lint comments.
357
358           Warning: this currently handles C- and C++-Style comments only. The
359           preprocessor does not yet recognize Fortran-style comments.
360
361       -Dname
362           Predefine name as a macro, with definition 1.
363
364       -Dname=definition
365           The contents of definition are tokenized and processed as if they
366           appeared during translation phase three in a '#define' directive.
367           In particular, the definition will be truncated by embedded newline
368           characters.
369
370           If you are invoking the preprocessor from a shell or shell-like
371           program you may need to use the shell's quoting syntax to protect
372           characters such as spaces that have a meaning in the shell syntax.
373
374           If you wish to define a function-like macro on the command line,
375           write its argument list with surrounding parentheses before the
376           equals sign (if any). Parentheses are meaningful to most shells, so
377           you will need to quote the option. With sh and csh,
378           "-D'name(args...)=definition'" works.
379
380           -D and -U options are processed in the order they are given on the
381           command line. All -imacros file and -include file options are
382           processed after all -D and -U options.
383
384       -H  Print the name of each header file used, in addition to other
385           normal activities. Each name is indented to show how deep in the
386           '#include' stack it is.
387
388       -P  Inhibit generation of linemarkers in the output from the
389           preprocessor.  This might be useful when running the preprocessor
390           on something that is not C code, and will be sent to a program
391           which might be confused by the linemarkers.
392
393       -Uname
394           Cancel any previous definition of name, either built in or provided
395           with a -D option.
396
397   Options to request or suppress errors and warnings
398       Errors are diagnostic messages that report that the GNU Fortran
399       compiler cannot compile the relevant piece of source code.  The
400       compiler will continue to process the program in an attempt to report
401       further errors to aid in debugging, but will not produce any compiled
402       output.
403
404       Warnings are diagnostic messages that report constructions which are
405       not inherently erroneous but which are risky or suggest there is likely
406       to be a bug in the program.  Unless -Werror is specified, they do not
407       prevent compilation of the program.
408
409       You can request many specific warnings with options beginning -W, for
410       example -Wimplicit to request warnings on implicit declarations.  Each
411       of these specific warning options also has a negative form beginning
412       -Wno- to turn off warnings; for example, -Wno-implicit.  This manual
413       lists only one of the two forms, whichever is not the default.
414
415       These options control the amount and kinds of errors and warnings
416       produced by GNU Fortran:
417
418       -fmax-errors=n
419           Limits the maximum number of error messages to n, at which point
420           GNU Fortran bails out rather than attempting to continue processing
421           the source code.  If n is 0, there is no limit on the number of
422           error messages produced.
423
424       -fsyntax-only
425           Check the code for syntax errors, but don't actually compile it.
426           This will generate module files for each module present in the
427           code, but no other output file.
428
429       -pedantic
430           Issue warnings for uses of extensions to Fortran 95.  -pedantic
431           also applies to C-language constructs where they occur in GNU
432           Fortran source files, such as use of \e in a character constant
433           within a directive like "#include".
434
435           Valid Fortran 95 programs should compile properly with or without
436           this option.  However, without this option, certain GNU extensions
437           and traditional Fortran features are supported as well.  With this
438           option, many of them are rejected.
439
440           Some users try to use -pedantic to check programs for conformance.
441           They soon find that it does not do quite what they want---it finds
442           some nonstandard practices, but not all.  However, improvements to
443           GNU Fortran in this area are welcome.
444
445           This should be used in conjunction with -std=f95, -std=f2003 or
446           -std=f2008.
447
448       -pedantic-errors
449           Like -pedantic, except that errors are produced rather than
450           warnings.
451
452       -Wall
453           Enables commonly used warning options pertaining to usage that we
454           recommend avoiding and that we believe are easy to avoid.  This
455           currently includes -Waliasing, -Wampersand, -Wsurprising,
456           -Wintrinsics-std, -Wno-tabs, -Wintrinsic-shadow and
457           -Wline-truncation.
458
459       -Waliasing
460           Warn about possible aliasing of dummy arguments. Specifically, it
461           warns if the same actual argument is associated with a dummy
462           argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)"
463           in a call with an explicit interface.
464
465           The following example will trigger the warning.
466
467                     interface
468                       subroutine bar(a,b)
469                         integer, intent(in) :: a
470                         integer, intent(out) :: b
471                       end subroutine
472                     end interface
473                     integer :: a
474
475                     call bar(a,a)
476
477       -Wampersand
478           Warn about missing ampersand in continued character constants. The
479           warning is given with -Wampersand, -pedantic, -std=f95, -std=f2003
480           and -std=f2008. Note: With no ampersand given in a continued
481           character constant, GNU Fortran assumes continuation at the first
482           non-comment, non-whitespace character after the ampersand that
483           initiated the continuation.
484
485       -Warray-temporaries
486           Warn about array temporaries generated by the compiler.  The
487           information generated by this warning is sometimes useful in
488           optimization, in order to avoid such temporaries.
489
490       -Wcharacter-truncation
491           Warn when a character assignment will truncate the assigned string.
492
493       -Wline-truncation
494           Warn when a source code line will be truncated.
495
496       -Wconversion
497           Warn about implicit conversions between different types.
498
499       -Wimplicit-interface
500           Warn if a procedure is called without an explicit interface.  Note
501           this only checks that an explicit interface is present.  It does
502           not check that the declared interfaces are consistent across
503           program units.
504
505       -Wimplicit-procedure
506           Warn if a procedure is called that has neither an explicit
507           interface nor has been declared as "EXTERNAL".
508
509       -Wintrinsics-std
510           Warn if gfortran finds a procedure named like an intrinsic not
511           available in the currently selected standard (with -std) and treats
512           it as "EXTERNAL" procedure because of this.  -fall-intrinsics can
513           be used to never trigger this behavior and always link to the
514           intrinsic regardless of the selected standard.
515
516       -Wsurprising
517           Produce a warning when "suspicious" code constructs are
518           encountered.  While technically legal these usually indicate that
519           an error has been made.
520
521           This currently produces a warning under the following
522           circumstances:
523
524           ·   An INTEGER SELECT construct has a CASE that can never be
525               matched as its lower value is greater than its upper value.
526
527           ·   A LOGICAL SELECT construct has three CASE statements.
528
529           ·   A TRANSFER specifies a source that is shorter than the
530               destination.
531
532           ·   The type of a function result is declared more than once with
533               the same type.  If -pedantic or standard-conforming mode is
534               enabled, this is an error.
535
536           ·   A "CHARACTER" variable is declared with negative length.
537
538       -Wtabs
539           By default, tabs are accepted as whitespace, but tabs are not
540           members of the Fortran Character Set.  For continuation lines, a
541           tab followed by a digit between 1 and 9 is supported.  -Wno-tabs
542           will cause a warning to be issued if a tab is encountered. Note,
543           -Wno-tabs is active for -pedantic, -std=f95, -std=f2003, -std=f2008
544           and -Wall.
545
546       -Wunderflow
547           Produce a warning when numerical constant expressions are
548           encountered, which yield an UNDERFLOW during compilation.
549
550       -Wintrinsic-shadow
551           Warn if a user-defined procedure or module procedure has the same
552           name as an intrinsic; in this case, an explicit interface or
553           "EXTERNAL" or "INTRINSIC" declaration might be needed to get calls
554           later resolved to the desired intrinsic/procedure.
555
556       -Wunused-parameter
557           Contrary to gcc's meaning of -Wunused-parameter, gfortran's
558           implementation of this option does not warn about unused dummy
559           arguments, but about unused "PARAMETER" values.  -Wunused-parameter
560           is not included in -Wall but is implied by -Wall -Wextra.
561
562       -Walign-commons
563           By default, gfortran warns about any occasion of variables being
564           padded for proper alignment inside a COMMON block. This warning can
565           be turned off via -Wno-align-commons. See also -falign-commons.
566
567       -Werror
568           Turns all warnings into errors.
569
570       Some of these have no effect when compiling programs written in
571       Fortran.
572
573   Options for debugging your program or GNU Fortran
574       GNU Fortran has various special options that are used for debugging
575       either your program or the GNU Fortran compiler.
576
577       -fdump-parse-tree
578           Output the internal parse tree before starting code generation.
579           Only really useful for debugging the GNU Fortran compiler itself.
580
581       -ffpe-trap=list
582           Specify a list of IEEE exceptions when a Floating Point Exception
583           (FPE) should be raised.  On most systems, this will result in a
584           SIGFPE signal being sent and the program being interrupted,
585           producing a core file useful for debugging.  list is a (possibly
586           empty) comma-separated list of the following IEEE exceptions:
587           invalid (invalid floating point operation, such as "SQRT(-1.0)"),
588           zero (division by zero), overflow (overflow in a floating point
589           operation), underflow (underflow in a floating point operation),
590           precision (loss of precision during operation) and denormal
591           (operation produced a denormal value).
592
593           Some of the routines in the Fortran runtime library, like CPU_TIME,
594           are likely to trigger floating point exceptions when
595           "ffpe-trap=precision" is used. For this reason, the use of
596           "ffpe-trap=precision" is not recommended.
597
598       -fbacktrace
599           Specify that, when a runtime error is encountered or a deadly
600           signal is emitted (segmentation fault, illegal instruction, bus
601           error or floating-point exception), the Fortran runtime library
602           should output a backtrace of the error.  This option only has
603           influence for compilation of the Fortran main program.
604
605       -fdump-core
606           Request that a core-dump file is written to disk when a runtime
607           error is encountered on systems that support core dumps. This
608           option is only effective for the compilation of the Fortran main
609           program.
610
611   Options for directory search
612       These options affect how GNU Fortran searches for files specified by
613       the "INCLUDE" directive and where it searches for previously compiled
614       modules.
615
616       It also affects the search paths used by cpp when used to preprocess
617       Fortran source.
618
619       -Idir
620           These affect interpretation of the "INCLUDE" directive (as well as
621           of the "#include" directive of the cpp preprocessor).
622
623           Also note that the general behavior of -I and "INCLUDE" is pretty
624           much the same as of -I with "#include" in the cpp preprocessor,
625           with regard to looking for header.gcc files and other such things.
626
627           This path is also used to search for .mod files when previously
628           compiled modules are required by a "USE" statement.
629
630       -Jdir
631       -Mdir
632           This option specifies where to put .mod files for compiled modules.
633           It is also added to the list of directories to searched by an "USE"
634           statement.
635
636           The default is the current directory.
637
638           -M is deprecated to avoid conflicts with existing GCC options.
639
640       -fintrinsic-modules-path dir
641           This option specifies the location of pre-compiled intrinsic
642           modules, if they are not in the default location expected by the
643           compiler.
644
645   Influencing the linking step
646       These options come into play when the compiler links object files into
647       an executable output file. They are meaningless if the compiler is not
648       doing a link step.
649
650       -static-libgfortran
651           On systems that provide libgfortran as a shared and a static
652           library, this option forces the use of the static version. If no
653           shared version of libgfortran was built when the compiler was
654           configured, this option has no effect.
655
656   Influencing runtime behavior
657       These options affect the runtime behavior of programs compiled with GNU
658       Fortran.
659
660       -fconvert=conversion
661           Specify the representation of data for unformatted files.  Valid
662           values for conversion are: native, the default; swap, swap between
663           big- and little-endian; big-endian, use big-endian representation
664           for unformatted files; little-endian, use little-endian
665           representation for unformatted files.
666
667           This option has an effect only when used in the main program.  The
668           "CONVERT" specifier and the GFORTRAN_CONVERT_UNIT environment
669           variable override the default specified by -fconvert.
670
671       -fno-range-check
672           Disable range checking of input values during integer "READ"
673           operations.  For example, GNU Fortran will give an error if an
674           input value is outside of the relevant range of
675           ["-HUGE()":"HUGE()"]. In other words, with "INTEGER (kind=4) :: i"
676           , attempting to read -2147483648 will give an error unless
677           -fno-range-check is given.
678
679       -frecord-marker=length
680           Specify the length of record markers for unformatted files.  Valid
681           values for length are 4 and 8.  Default is 4.  This is different
682           from previous versions of gfortran, which specified a default
683           record marker length of 8 on most systems.  If you want to read or
684           write files compatible with earlier versions of gfortran, use
685           -frecord-marker=8.
686
687       -fmax-subrecord-length=length
688           Specify the maximum length for a subrecord.  The maximum permitted
689           value for length is 2147483639, which is also the default.  Only
690           really useful for use by the gfortran testsuite.
691
692       -fsign-zero
693           When enabled, floating point numbers of value zero with the sign
694           bit set are written as negative number in formatted output and
695           treated as negative in the "SIGN" intrinsic.  "fno-sign-zero" does
696           not print the negative sign of zero values and regards zero as
697           positive number in the "SIGN" intrinsic for compatibility with F77.
698           Default behavior is to show the negative sign.
699
700   Options for code generation conventions
701       These machine-independent options control the interface conventions
702       used in code generation.
703
704       Most of them have both positive and negative forms; the negative form
705       of -ffoo would be -fno-foo.  In the table below, only one of the forms
706       is listed---the one which is not the default.  You can figure out the
707       other form by either removing no- or adding it.
708
709       -fno-automatic
710           Treat each program unit (except those marked as RECURSIVE) as if
711           the "SAVE" statement were specified for every local variable and
712           array referenced in it. Does not affect common blocks. (Some
713           Fortran compilers provide this option under the name -static or
714           -save.)  The default, which is -fautomatic, uses the stack for
715           local variables smaller than the value given by
716           -fmax-stack-var-size.  Use the option -frecursive to use no static
717           memory.
718
719       -ff2c
720           Generate code designed to be compatible with code generated by g77
721           and f2c.
722
723           The calling conventions used by g77 (originally implemented in f2c)
724           require functions that return type default "REAL" to actually
725           return the C type "double", and functions that return type
726           "COMPLEX" to return the values via an extra argument in the calling
727           sequence that points to where to store the return value.  Under the
728           default GNU calling conventions, such functions simply return their
729           results as they would in GNU C---default "REAL" functions return
730           the C type "float", and "COMPLEX" functions return the GNU C type
731           "complex".  Additionally, this option implies the
732           -fsecond-underscore option, unless -fno-second-underscore is
733           explicitly requested.
734
735           This does not affect the generation of code that interfaces with
736           the libgfortran library.
737
738           Caution: It is not a good idea to mix Fortran code compiled with
739           -ff2c with code compiled with the default -fno-f2c calling
740           conventions as, calling "COMPLEX" or default "REAL" functions
741           between program parts which were compiled with different calling
742           conventions will break at execution time.
743
744           Caution: This will break code which passes intrinsic functions of
745           type default "REAL" or "COMPLEX" as actual arguments, as the
746           library implementations use the -fno-f2c calling conventions.
747
748       -fno-underscoring
749           Do not transform names of entities specified in the Fortran source
750           file by appending underscores to them.
751
752           With -funderscoring in effect, GNU Fortran appends one underscore
753           to external names with no underscores.  This is done to ensure
754           compatibility with code produced by many UNIX Fortran compilers.
755
756           Caution: The default behavior of GNU Fortran is incompatible with
757           f2c and g77, please use the -ff2c option if you want object files
758           compiled with GNU Fortran to be compatible with object code created
759           with these tools.
760
761           Use of -fno-underscoring is not recommended unless you are
762           experimenting with issues such as integration of GNU Fortran into
763           existing system environments (vis-@`{a}-vis existing libraries,
764           tools, and so on).
765
766           For example, with -funderscoring, and assuming other defaults like
767           -fcase-lower and that "j()" and "max_count()" are external
768           functions while "my_var" and "lvar" are local variables, a
769           statement like
770
771                   I = J() + MAX_COUNT (MY_VAR, LVAR)
772
773           is implemented as something akin to:
774
775                   i = j_() + max_count__(&my_var__, &lvar);
776
777           With -fno-underscoring, the same statement is implemented as:
778
779                   i = j() + max_count(&my_var, &lvar);
780
781           Use of -fno-underscoring allows direct specification of user-
782           defined names while debugging and when interfacing GNU Fortran code
783           with other languages.
784
785           Note that just because the names match does not mean that the
786           interface implemented by GNU Fortran for an external name matches
787           the interface implemented by some other language for that same
788           name.  That is, getting code produced by GNU Fortran to link to
789           code produced by some other compiler using this or any other method
790           can be only a small part of the overall solution---getting the code
791           generated by both compilers to agree on issues other than naming
792           can require significant effort, and, unlike naming disagreements,
793           linkers normally cannot detect disagreements in these other areas.
794
795           Also, note that with -fno-underscoring, the lack of appended
796           underscores introduces the very real possibility that a user-
797           defined external name will conflict with a name in a system
798           library, which could make finding unresolved-reference bugs quite
799           difficult in some cases---they might occur at program run time, and
800           show up only as buggy behavior at run time.
801
802           In future versions of GNU Fortran we hope to improve naming and
803           linking issues so that debugging always involves using the names as
804           they appear in the source, even if the names as seen by the linker
805           are mangled to prevent accidental linking between procedures with
806           incompatible interfaces.
807
808       -fwhole-file
809           By default, GNU Fortran parses, resolves and translates each
810           procedure in a file separately.  Using this option modifies this
811           such that the whole file is parsed and placed in a single front-end
812           tree.  During resolution, in addition to all the usual checks and
813           fixups, references to external procedures that are in the same file
814           effect resolution of that procedure, if not already done, and a
815           check of the interfaces. The dependences are resolved by changing
816           the order in which the file is translated into the backend tree.
817           Thus, a procedure that is referenced is translated before the
818           reference and the duplication of backend tree declarations
819           eliminated.
820
821       -fsecond-underscore
822           By default, GNU Fortran appends an underscore to external names.
823           If this option is used GNU Fortran appends two underscores to names
824           with underscores and one underscore to external names with no
825           underscores.  GNU Fortran also appends two underscores to internal
826           names with underscores to avoid naming collisions with external
827           names.
828
829           This option has no effect if -fno-underscoring is in effect.  It is
830           implied by the -ff2c option.
831
832           Otherwise, with this option, an external name such as "MAX_COUNT"
833           is implemented as a reference to the link-time external symbol
834           "max_count__", instead of "max_count_".  This is required for
835           compatibility with g77 and f2c, and is implied by use of the -ff2c
836           option.
837
838       -fcheck=<keyword>
839           Enable the generation of run-time checks; the argument shall be a
840           comma-delimited list of the following keywords.
841
842           all Enable all run-time test of -fcheck.
843
844           array-temps
845               Warns at run time when for passing an actual argument a
846               temporary array had to be generated. The information generated
847               by this warning is sometimes useful in optimization, in order
848               to avoid such temporaries.
849
850               Note: The warning is only printed once per location.
851
852           bounds
853               Enable generation of run-time checks for array subscripts and
854               against the declared minimum and maximum values.  It also
855               checks array indices for assumed and deferred shape arrays
856               against the actual allocated bounds and ensures that all string
857               lengths are equal for character array constructors without an
858               explicit typespec.
859
860               Some checks require that -fcheck=bounds is set for the
861               compilation of the main program.
862
863               Note: In the future this may also include other forms of
864               checking, e.g., checking substring references.
865
866           do  Enable generation of run-time checks for invalid modification
867               of loop iteration variables.
868
869           mem Enable generation of run-time checks for memory allocation.
870               Note: This option does not affect explicit allocations using
871               the "ALLOCATE" statement, which will be always checked.
872
873           pointer
874               Enable generation of run-time checks for pointers and
875               allocatables.
876
877           recursion
878               Enable generation of run-time checks for recursively called
879               subroutines and functions which are not marked as recursive.
880               See also -frecursive.  Note: This check does not work for
881               OpenMP programs and is disabled if used together with
882               -frecursive and -fopenmp.
883
884       -fbounds-check
885           Deprecated alias for -fcheck=bounds.
886
887       -fcheck-array-temporaries
888           Deprecated alias for -fcheck=array-temps.
889
890       -fmax-array-constructor=n
891           This option can be used to increase the upper limit permitted in
892           array constructors.  The code below requires this option to expand
893           the array at compile time.
894
895                   C<program test>
896                   C<implicit none>
897                   C<integer j>
898                   C<integer, parameter :: n = 100000>
899                   C<integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)>
900                   C<print '(10(I0,1X))', i>
901                   C<end program test>
902
903           Caution:  This option can lead to long compile times and
904           excessively large object files.
905
906           The default value for n is 65535.
907
908       -fmax-stack-var-size=n
909           This option specifies the size in bytes of the largest array that
910           will be put on the stack; if the size is exceeded static memory is
911           used (except in procedures marked as RECURSIVE). Use the option
912           -frecursive to allow for recursive procedures which do not have a
913           RECURSIVE attribute or for parallel programs. Use -fno-automatic to
914           never use the stack.
915
916           This option currently only affects local arrays declared with
917           constant bounds, and may not apply to all character variables.
918           Future versions of GNU Fortran may improve this behavior.
919
920           The default value for n is 32768.
921
922       -fpack-derived
923           This option tells GNU Fortran to pack derived type members as
924           closely as possible.  Code compiled with this option is likely to
925           be incompatible with code compiled without this option, and may
926           execute slower.
927
928       -frepack-arrays
929           In some circumstances GNU Fortran may pass assumed shape array
930           sections via a descriptor describing a noncontiguous area of
931           memory.  This option adds code to the function prologue to repack
932           the data into a contiguous block at runtime.
933
934           This should result in faster accesses to the array.  However it can
935           introduce significant overhead to the function call, especially
936           when the passed data is noncontiguous.
937
938       -fshort-enums
939           This option is provided for interoperability with C code that was
940           compiled with the -fshort-enums option.  It will make GNU Fortran
941           choose the smallest "INTEGER" kind a given enumerator set will fit
942           in, and give all its enumerators this kind.
943
944       -fexternal-blas
945           This option will make gfortran generate calls to BLAS functions for
946           some matrix operations like "MATMUL", instead of using our own
947           algorithms, if the size of the matrices involved is larger than a
948           given limit (see -fblas-matmul-limit).  This may be profitable if
949           an optimized vendor BLAS library is available.  The BLAS library
950           will have to be specified at link time.
951
952       -fblas-matmul-limit=n
953           Only significant when -fexternal-blas is in effect.  Matrix
954           multiplication of matrices with size larger than (or equal to) n
955           will be performed by calls to BLAS functions, while others will be
956           handled by gfortran internal algorithms. If the matrices involved
957           are not square, the size comparison is performed using the
958           geometric mean of the dimensions of the argument and result
959           matrices.
960
961           The default value for n is 30.
962
963       -frecursive
964           Allow indirect recursion by forcing all local arrays to be
965           allocated on the stack. This flag cannot be used together with
966           -fmax-stack-var-size= or -fno-automatic.
967
968       -finit-local-zero
969       -finit-integer=n
970       -finit-real=<zero|inf|-inf|nan|snan>
971       -finit-logical=<true|false>
972       -finit-character=n
973           The -finit-local-zero option instructs the compiler to initialize
974           local "INTEGER", "REAL", and "COMPLEX" variables to zero, "LOGICAL"
975           variables to false, and "CHARACTER" variables to a string of null
976           bytes.  Finer-grained initialization options are provided by the
977           -finit-integer=n, -finit-real=<zero|inf|-inf|nan|snan> (which also
978           initializes the real and imaginary parts of local "COMPLEX"
979           variables), -finit-logical=<true|false>, and -finit-character=n
980           (where n is an ASCII character value) options.  These options do
981           not initialize components of derived type variables, nor do they
982           initialize variables that appear in an "EQUIVALENCE" statement.
983           (This limitation may be removed in future releases).
984
985           Note that the -finit-real=nan option initializes "REAL" and
986           "COMPLEX" variables with a quiet NaN. For a signalling NaN use
987           -finit-real=snan; note, however, that compile-time optimizations
988           may convert them into quiet NaN and that trapping needs to be
989           enabled (e.g. via -ffpe-trap).
990
991       -falign-commons
992           By default, gfortran enforces proper alignment of all variables in
993           a COMMON block by padding them as needed. On certain platforms this
994           is mandatory, on others it increases performance. If a COMMON block
995           is not declared with consistent data types everywhere, this padding
996           can cause trouble, and -fno-align-commons  can be used to disable
997           automatic alignment. The same form of this option should be used
998           for all files that share a COMMON block.  To avoid potential
999           alignment issues in COMMON blocks, it is recommended to order
1000           objects from largests to smallest.
1001
1002       -fno-protect-parens
1003           By default the parentheses in expression are honored for all
1004           optimization levels such that the compiler does not do any re-
1005           association. Using -fno-protect-parens allows the compiler to
1006           reorder REAL and COMPLEX expressions to produce faster code. Note
1007           that for the re-association optimization -fno-signed-zeros and
1008           -fno-trapping-math need to be in effect.
1009

ENVIRONMENT

1011       The gfortran compiler currently does not make use of any environment
1012       variables to control its operation above and beyond those that affect
1013       the operation of gcc.
1014

BUGS

1016       For instructions on reporting bugs, see
1017       <http://bugzilla.redhat.com/bugzilla>.
1018

SEE ALSO

1020       gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), gcc(1), as(1), ld(1),
1021       gdb(1), adb(1), dbx(1), sdb(1) and the Info entries for gcc, cpp,
1022       gfortran, as, ld, binutils and gdb.
1023

AUTHOR

1025       See the Info entry for gfortran for contributors to GCC and GNU
1026       Fortran.
1027
1029       Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 Free Software
1030       Foundation, Inc.
1031
1032       Permission is granted to copy, distribute and/or modify this document
1033       under the terms of the GNU Free Documentation License, Version 1.2 or
1034       any later version published by the Free Software Foundation; with the
1035       Invariant Sections being "Funding Free Software", the Front-Cover Texts
1036       being (a) (see below), and with the Back-Cover Texts being (b) (see
1037       below).  A copy of the license is included in the gfdl(7) man page.
1038
1039       (a) The FSF's Front-Cover Text is:
1040
1041            A GNU Manual
1042
1043       (b) The FSF's Back-Cover Text is:
1044
1045            You have freedom to copy and modify this GNU Manual, like GNU
1046            software.  Copies published by the Free Software Foundation raise
1047            funds for GNU development.
1048
1049
1050
1051gcc-4.5.0                         2010-05-13                       GFORTRAN(1)
Impressum