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

ENVIRONMENT

939       The gfortran compiler currently does not make use of any environment
940       variables to control its operation above and beyond those that affect
941       the operation of gcc.
942

BUGS

944       For instructions on reporting bugs, see
945       <http://bugzilla.redhat.com/bugzilla>.
946

SEE ALSO

948       gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), gcc(1), as(1), ld(1),
949       gdb(1), adb(1), dbx(1), sdb(1) and the Info entries for gcc, cpp,
950       gfortran, as, ld, binutils and gdb.
951

AUTHOR

953       See the Info entry for gfortran for contributors to GCC and GNU
954       Fortran.
955
957       Copyright (c) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
958       Inc.
959
960       Permission is granted to copy, distribute and/or modify this document
961       under the terms of the GNU Free Documentation License, Version 1.2 or
962       any later version published by the Free Software Foundation; with the
963       Invariant Sections being "Funding Free Software", the Front-Cover Texts
964       being (a) (see below), and with the Back-Cover Texts being (b) (see
965       below).  A copy of the license is included in the gfdl(7) man page.
966
967       (a) The FSF's Front-Cover Text is:
968
969            A GNU Manual
970
971       (b) The FSF's Back-Cover Text is:
972
973            You have freedom to copy and modify this GNU Manual, like GNU
974            software.  Copies published by the Free Software Foundation raise
975            funds for GNU development.
976
977
978
979gcc-4.4.7                         2012-03-13                       GFORTRAN(1)
Impressum