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 -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           This option specifies where to put .mod files for compiled modules.
632           It is also added to the list of directories to searched by an "USE"
633           statement.
634
635           The default is the current directory.
636
637       -fintrinsic-modules-path dir
638           This option specifies the location of pre-compiled intrinsic
639           modules, if they are not in the default location expected by the
640           compiler.
641
642   Influencing the linking step
643       These options come into play when the compiler links object files into
644       an executable output file. They are meaningless if the compiler is not
645       doing a link step.
646
647       -static-libgfortran
648           On systems that provide libgfortran as a shared and a static
649           library, this option forces the use of the static version. If no
650           shared version of libgfortran was built when the compiler was
651           configured, this option has no effect.
652
653   Influencing runtime behavior
654       These options affect the runtime behavior of programs compiled with GNU
655       Fortran.
656
657       -fconvert=conversion
658           Specify the representation of data for unformatted files.  Valid
659           values for conversion are: native, the default; swap, swap between
660           big- and little-endian; big-endian, use big-endian representation
661           for unformatted files; little-endian, use little-endian
662           representation for unformatted files.
663
664           This option has an effect only when used in the main program.  The
665           "CONVERT" specifier and the GFORTRAN_CONVERT_UNIT environment
666           variable override the default specified by -fconvert.
667
668       -fno-range-check
669           Disable range checking of input values during integer "READ"
670           operations.  For example, GNU Fortran will give an error if an
671           input value is outside of the relevant range of
672           ["-HUGE()":"HUGE()"]. In other words, with "INTEGER (kind=4) :: i"
673           , attempting to read -2147483648 will give an error unless
674           -fno-range-check is given.
675
676       -frecord-marker=length
677           Specify the length of record markers for unformatted files.  Valid
678           values for length are 4 and 8.  Default is 4.  This is different
679           from previous versions of gfortran, which specified a default
680           record marker length of 8 on most systems.  If you want to read or
681           write files compatible with earlier versions of gfortran, use
682           -frecord-marker=8.
683
684       -fmax-subrecord-length=length
685           Specify the maximum length for a subrecord.  The maximum permitted
686           value for length is 2147483639, which is also the default.  Only
687           really useful for use by the gfortran testsuite.
688
689       -fsign-zero
690           When enabled, floating point numbers of value zero with the sign
691           bit set are written as negative number in formatted output and
692           treated as negative in the "SIGN" intrinsic.  "fno-sign-zero" does
693           not print the negative sign of zero values and regards zero as
694           positive number in the "SIGN" intrinsic for compatibility with F77.
695           Default behavior is to show the negative sign.
696
697   Options for code generation conventions
698       These machine-independent options control the interface conventions
699       used in code generation.
700
701       Most of them have both positive and negative forms; the negative form
702       of -ffoo would be -fno-foo.  In the table below, only one of the forms
703       is listed---the one which is not the default.  You can figure out the
704       other form by either removing no- or adding it.
705
706       -fno-automatic
707           Treat each program unit (except those marked as RECURSIVE) as if
708           the "SAVE" statement were specified for every local variable and
709           array referenced in it. Does not affect common blocks. (Some
710           Fortran compilers provide this option under the name -static or
711           -save.)  The default, which is -fautomatic, uses the stack for
712           local variables smaller than the value given by
713           -fmax-stack-var-size.  Use the option -frecursive to use no static
714           memory.
715
716       -ff2c
717           Generate code designed to be compatible with code generated by g77
718           and f2c.
719
720           The calling conventions used by g77 (originally implemented in f2c)
721           require functions that return type default "REAL" to actually
722           return the C type "double", and functions that return type
723           "COMPLEX" to return the values via an extra argument in the calling
724           sequence that points to where to store the return value.  Under the
725           default GNU calling conventions, such functions simply return their
726           results as they would in GNU C---default "REAL" functions return
727           the C type "float", and "COMPLEX" functions return the GNU C type
728           "complex".  Additionally, this option implies the
729           -fsecond-underscore option, unless -fno-second-underscore is
730           explicitly requested.
731
732           This does not affect the generation of code that interfaces with
733           the libgfortran library.
734
735           Caution: It is not a good idea to mix Fortran code compiled with
736           -ff2c with code compiled with the default -fno-f2c calling
737           conventions as, calling "COMPLEX" or default "REAL" functions
738           between program parts which were compiled with different calling
739           conventions will break at execution time.
740
741           Caution: This will break code which passes intrinsic functions of
742           type default "REAL" or "COMPLEX" as actual arguments, as the
743           library implementations use the -fno-f2c calling conventions.
744
745       -fno-underscoring
746           Do not transform names of entities specified in the Fortran source
747           file by appending underscores to them.
748
749           With -funderscoring in effect, GNU Fortran appends one underscore
750           to external names with no underscores.  This is done to ensure
751           compatibility with code produced by many UNIX Fortran compilers.
752
753           Caution: The default behavior of GNU Fortran is incompatible with
754           f2c and g77, please use the -ff2c option if you want object files
755           compiled with GNU Fortran to be compatible with object code created
756           with these tools.
757
758           Use of -fno-underscoring is not recommended unless you are
759           experimenting with issues such as integration of GNU Fortran into
760           existing system environments (vis-@`{a}-vis existing libraries,
761           tools, and so on).
762
763           For example, with -funderscoring, and assuming other defaults like
764           -fcase-lower and that "j()" and "max_count()" are external
765           functions while "my_var" and "lvar" are local variables, a
766           statement like
767
768                   I = J() + MAX_COUNT (MY_VAR, LVAR)
769
770           is implemented as something akin to:
771
772                   i = j_() + max_count__(&my_var__, &lvar);
773
774           With -fno-underscoring, the same statement is implemented as:
775
776                   i = j() + max_count(&my_var, &lvar);
777
778           Use of -fno-underscoring allows direct specification of user-
779           defined names while debugging and when interfacing GNU Fortran code
780           with other languages.
781
782           Note that just because the names match does not mean that the
783           interface implemented by GNU Fortran for an external name matches
784           the interface implemented by some other language for that same
785           name.  That is, getting code produced by GNU Fortran to link to
786           code produced by some other compiler using this or any other method
787           can be only a small part of the overall solution---getting the code
788           generated by both compilers to agree on issues other than naming
789           can require significant effort, and, unlike naming disagreements,
790           linkers normally cannot detect disagreements in these other areas.
791
792           Also, note that with -fno-underscoring, the lack of appended
793           underscores introduces the very real possibility that a user-
794           defined external name will conflict with a name in a system
795           library, which could make finding unresolved-reference bugs quite
796           difficult in some cases---they might occur at program run time, and
797           show up only as buggy behavior at run time.
798
799           In future versions of GNU Fortran we hope to improve naming and
800           linking issues so that debugging always involves using the names as
801           they appear in the source, even if the names as seen by the linker
802           are mangled to prevent accidental linking between procedures with
803           incompatible interfaces.
804
805       -fwhole-file
806           By default, GNU Fortran parses, resolves and translates each
807           procedure in a file separately.  Using this option modifies this
808           such that the whole file is parsed and placed in a single front-end
809           tree.  During resolution, in addition to all the usual checks and
810           fixups, references to external procedures that are in the same file
811           effect resolution of that procedure, if not already done, and a
812           check of the interfaces. The dependences are resolved by changing
813           the order in which the file is translated into the backend tree.
814           Thus, a procedure that is referenced is translated before the
815           reference and the duplication of backend tree declarations
816           eliminated.
817
818       -fsecond-underscore
819           By default, GNU Fortran appends an underscore to external names.
820           If this option is used GNU Fortran appends two underscores to names
821           with underscores and one underscore to external names with no
822           underscores.  GNU Fortran also appends two underscores to internal
823           names with underscores to avoid naming collisions with external
824           names.
825
826           This option has no effect if -fno-underscoring is in effect.  It is
827           implied by the -ff2c option.
828
829           Otherwise, with this option, an external name such as "MAX_COUNT"
830           is implemented as a reference to the link-time external symbol
831           "max_count__", instead of "max_count_".  This is required for
832           compatibility with g77 and f2c, and is implied by use of the -ff2c
833           option.
834
835       -fcheck=<keyword>
836           Enable the generation of run-time checks; the argument shall be a
837           comma-delimited list of the following keywords.
838
839           all Enable all run-time test of -fcheck.
840
841           array-temps
842               Warns at run time when for passing an actual argument a
843               temporary array had to be generated. The information generated
844               by this warning is sometimes useful in optimization, in order
845               to avoid such temporaries.
846
847               Note: The warning is only printed once per location.
848
849           bounds
850               Enable generation of run-time checks for array subscripts and
851               against the declared minimum and maximum values.  It also
852               checks array indices for assumed and deferred shape arrays
853               against the actual allocated bounds and ensures that all string
854               lengths are equal for character array constructors without an
855               explicit typespec.
856
857               Some checks require that -fcheck=bounds is set for the
858               compilation of the main program.
859
860               Note: In the future this may also include other forms of
861               checking, e.g., checking substring references.
862
863           do  Enable generation of run-time checks for invalid modification
864               of loop iteration variables.
865
866           mem Enable generation of run-time checks for memory allocation.
867               Note: This option does not affect explicit allocations using
868               the "ALLOCATE" statement, which will be always checked.
869
870           pointer
871               Enable generation of run-time checks for pointers and
872               allocatables.
873
874           recursion
875               Enable generation of run-time checks for recursively called
876               subroutines and functions which are not marked as recursive.
877               See also -frecursive.  Note: This check does not work for
878               OpenMP programs and is disabled if used together with
879               -frecursive and -fopenmp.
880
881       -fbounds-check
882           Deprecated alias for -fcheck=bounds.
883
884       -fcheck-array-temporaries
885           Deprecated alias for -fcheck=array-temps.
886
887       -fmax-array-constructor=n
888           This option can be used to increase the upper limit permitted in
889           array constructors.  The code below requires this option to expand
890           the array at compile time.
891
892                   C<program test>
893                   C<implicit none>
894                   C<integer j>
895                   C<integer, parameter :: n = 100000>
896                   C<integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)>
897                   C<print '(10(I0,1X))', i>
898                   C<end program test>
899
900           Caution:  This option can lead to long compile times and
901           excessively large object files.
902
903           The default value for n is 65535.
904
905       -fmax-stack-var-size=n
906           This option specifies the size in bytes of the largest array that
907           will be put on the stack; if the size is exceeded static memory is
908           used (except in procedures marked as RECURSIVE). Use the option
909           -frecursive to allow for recursive procedures which do not have a
910           RECURSIVE attribute or for parallel programs. Use -fno-automatic to
911           never use the stack.
912
913           This option currently only affects local arrays declared with
914           constant bounds, and may not apply to all character variables.
915           Future versions of GNU Fortran may improve this behavior.
916
917           The default value for n is 32768.
918
919       -fpack-derived
920           This option tells GNU Fortran to pack derived type members as
921           closely as possible.  Code compiled with this option is likely to
922           be incompatible with code compiled without this option, and may
923           execute slower.
924
925       -frepack-arrays
926           In some circumstances GNU Fortran may pass assumed shape array
927           sections via a descriptor describing a noncontiguous area of
928           memory.  This option adds code to the function prologue to repack
929           the data into a contiguous block at runtime.
930
931           This should result in faster accesses to the array.  However it can
932           introduce significant overhead to the function call, especially
933           when the passed data is noncontiguous.
934
935       -fshort-enums
936           This option is provided for interoperability with C code that was
937           compiled with the -fshort-enums option.  It will make GNU Fortran
938           choose the smallest "INTEGER" kind a given enumerator set will fit
939           in, and give all its enumerators this kind.
940
941       -fexternal-blas
942           This option will make gfortran generate calls to BLAS functions for
943           some matrix operations like "MATMUL", instead of using our own
944           algorithms, if the size of the matrices involved is larger than a
945           given limit (see -fblas-matmul-limit).  This may be profitable if
946           an optimized vendor BLAS library is available.  The BLAS library
947           will have to be specified at link time.
948
949       -fblas-matmul-limit=n
950           Only significant when -fexternal-blas is in effect.  Matrix
951           multiplication of matrices with size larger than (or equal to) n
952           will be performed by calls to BLAS functions, while others will be
953           handled by gfortran internal algorithms. If the matrices involved
954           are not square, the size comparison is performed using the
955           geometric mean of the dimensions of the argument and result
956           matrices.
957
958           The default value for n is 30.
959
960       -frecursive
961           Allow indirect recursion by forcing all local arrays to be
962           allocated on the stack. This flag cannot be used together with
963           -fmax-stack-var-size= or -fno-automatic.
964
965       -finit-local-zero
966       -finit-integer=n
967       -finit-real=<zero|inf|-inf|nan|snan>
968       -finit-logical=<true|false>
969       -finit-character=n
970           The -finit-local-zero option instructs the compiler to initialize
971           local "INTEGER", "REAL", and "COMPLEX" variables to zero, "LOGICAL"
972           variables to false, and "CHARACTER" variables to a string of null
973           bytes.  Finer-grained initialization options are provided by the
974           -finit-integer=n, -finit-real=<zero|inf|-inf|nan|snan> (which also
975           initializes the real and imaginary parts of local "COMPLEX"
976           variables), -finit-logical=<true|false>, and -finit-character=n
977           (where n is an ASCII character value) options.  These options do
978           not initialize components of derived type variables, nor do they
979           initialize variables that appear in an "EQUIVALENCE" statement.
980           (This limitation may be removed in future releases).
981
982           Note that the -finit-real=nan option initializes "REAL" and
983           "COMPLEX" variables with a quiet NaN. For a signalling NaN use
984           -finit-real=snan; note, however, that compile-time optimizations
985           may convert them into quiet NaN and that trapping needs to be
986           enabled (e.g. via -ffpe-trap).
987
988       -falign-commons
989           By default, gfortran enforces proper alignment of all variables in
990           a COMMON block by padding them as needed. On certain platforms this
991           is mandatory, on others it increases performance. If a COMMON block
992           is not declared with consistent data types everywhere, this padding
993           can cause trouble, and -fno-align-commons  can be used to disable
994           automatic alignment. The same form of this option should be used
995           for all files that share a COMMON block.  To avoid potential
996           alignment issues in COMMON blocks, it is recommended to order
997           objects from largests to smallest.
998
999       -fno-protect-parens
1000           By default the parentheses in expression are honored for all
1001           optimization levels such that the compiler does not do any re-
1002           association. Using -fno-protect-parens allows the compiler to
1003           reorder REAL and COMPLEX expressions to produce faster code. Note
1004           that for the re-association optimization -fno-signed-zeros and
1005           -fno-trapping-math need to be in effect.
1006

ENVIRONMENT

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

BUGS

1013       For instructions on reporting bugs, see
1014       <http://bugzilla.redhat.com/bugzilla>.
1015

SEE ALSO

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

AUTHOR

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