1 @c Copyright (C) 2004, 2005, 2006
2 @c Free Software Foundation, Inc.
3 @c This is part of the GFORTRAN manual.
4 @c For copying conditions, see the file gfortran.texi.
8 Copyright @copyright{} 2004, 2005, 2006
9 Free Software Foundation, Inc.
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below). A copy of the license is
17 included in the gfdl(7) man page.
19 (a) The FSF's Front-Cover Text is:
23 (b) The FSF's Back-Cover Text is:
25 You have freedom to copy and modify this GNU Manual, like GNU
26 software. Copies published by the Free Software Foundation raise
27 funds for GNU development.
29 @c Set file name and title for the man page.
31 @settitle GNU Fortran 95 compiler.
33 gfortran [@option{-c}|@option{-S}|@option{-E}]
34 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38 [@option{-f}@var{option}@dots{}]
39 [@option{-m}@var{machine-option}@dots{}]
40 [@option{-o} @var{outfile}] @var{infile}@dots{}
42 Only the most useful options are listed here; see below for the
46 gpl(7), gfdl(7), fsf-funding(7),
47 cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
48 and the Info entries for @file{gcc}, @file{cpp}, @file{gfortran}, @file{as},
49 @file{ld}, @file{binutils} and @file{gdb}.
52 For instructions on reporting bugs, see
53 @w{@uref{http://gcc.gnu.org/bugs.html}}.
56 See the Info entry for @command{gfortran} for contributors to GCC and
61 @node Invoking GFORTRAN
62 @chapter GNU Fortran 95 Command Options
63 @cindex GNU Fortran 95 command options
64 @cindex command options
65 @cindex options, GNU Fortran 95 command
67 @c man begin DESCRIPTION
69 The @command{gfortran} command supports all the options supported by the
70 @command{gcc} command. Only options specific to gfortran are documented here.
72 @xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
73 Collection (GCC)}, for information
74 on the non-Fortran-specific aspects of the @command{gcc} command (and,
75 therefore, the @command{gfortran} command).
77 @cindex options, negative forms
78 @cindex negative forms of options
79 All @command{gcc} and @command{gfortran} options
80 are accepted both by @command{gfortran} and by @command{gcc}
81 (as well as any other drivers built at the same time,
82 such as @command{g++}),
83 since adding @command{gfortran} to the @command{gcc} distribution
84 enables acceptance of @command{gfortran} options
85 by all of the relevant drivers.
87 In some cases, options have positive and negative forms;
88 the negative form of @option{-ffoo} would be @option{-fno-foo}.
89 This manual documents only one of these two forms, whichever
90 one is not the default.
94 * Option Summary:: Brief list of all @command{gfortran} options,
96 * Fortran Dialect Options:: Controlling the variant of Fortran language
98 * Warning Options:: How picky should the compiler be?
99 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
100 * Directory Options:: Where to find module files
101 * Runtime Options:: Influencing runtime behavior
102 * Code Gen Options:: Specifying conventions for function calls, data layout
104 * Environment Variables:: Env vars that affect GNU Fortran.
108 @section Option Summary
112 Here is a summary of all the options specific to GNU Fortran, grouped
113 by type. Explanations are in the following sections.
116 @item Fortran Language Options
117 @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
119 -fall-intrinsics -ffree-form -fno-fixed-form @gol
120 -fdollar-ok -fimplicit-none -fmax-identifier-length @gol
121 -std=@var{std} -fd-lines-as-code -fd-lines-as-comments @gol
122 -ffixed-line-length-@var{n} -ffixed-line-length-none @gol
123 -ffree-line-length-@var{n} -ffree-line-length-none @gol
124 -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol
125 -fcray-pointer -fopenmp }
127 @item Warning Options
128 @xref{Warning Options,,Options to Request or Suppress Warnings}.
130 -fsyntax-only -pedantic -pedantic-errors @gol
131 -w -Wall -Waliasing -Wampersand -Wconversion -Wimplicit-interface @gol
132 -Wtabs -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
133 -Wunused-labels -Wline-truncation -W}
135 @item Debugging Options
136 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
138 -fdump-parse-tree -ffpe-trap=@var{list}}
140 @item Directory Options
141 @xref{Directory Options,,Options for Directory Search}.
143 -I@var{dir} -M@var{dir}}
145 @item Runtime Options
146 @xref{Runtime Options,,Options for influencing runtime behavior}.
148 -fconvert=@var{conversion} -frecord-marker=@var{length}}
150 @item Code Generation Options
151 @xref{Code Gen Options,,Options for Code Generation Conventions}.
153 -fno-automatic -ff2c -fno-underscoring -fsecond-underscore @gol
154 -fbounds-check -fmax-stack-var-size=@var{n} @gol
155 -fpackderived -frepack-arrays -fshort-enums}
159 * Fortran Dialect Options:: Controlling the variant of Fortran language
161 * Warning Options:: How picky should the compiler be?
162 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
163 * Directory Options:: Where to find module files
164 * Runtime Options:: Influencing runtime behavior
165 * Code Gen Options:: Specifying conventions for function calls, data layout
169 @node Fortran Dialect Options
170 @section Options Controlling Fortran Dialect
171 @cindex dialect options
172 @cindex language, dialect options
173 @cindex options, dialect
175 The following options control the dialect of Fortran
176 that the compiler accepts:
179 @cindex -ffree-form option
180 @cindex options, -ffree-form
181 @cindex -fno-fixed-form option
182 @cindex options, -fno-fixed-form
183 @cindex source file format
187 @cindex Fortran 90, features
190 Specify the layout used by the source file. The free form layout
191 was introduced in Fortran 90. Fixed form was traditionally used in
192 older Fortran programs.
194 @cindex -fall-intrinsics
195 @item -fall-intrinsics
196 Accept all of the intrinsic procedures provided in libgfortran
197 without regard to the setting of @option{-std}. In particular,
198 this option can be quite useful with @option{-std=f95}.
200 @cindex option, -fd-lines-as-code
201 @cindex -fd-lines-as-code, option
202 @cindex option, -fd-lines-as-comments
203 @cindex -fd-lines-as-comments, option
204 @item -fd-lines-as-code
205 @item -fd-lines-as-comment
206 Enables special treating for lines with @samp{d} or @samp{D} in fixed
207 form sources. If the @option{-fd-lines-as-code} option is given
208 they are treated as if the first column contained a blank. If the
209 @option{-fd-lines-as-comments} option is given, they are treated as
212 @cindex option, -fdefault-double-8
213 @cindex -fdefault-double-8, option
214 @item -fdefault-double-8
215 Set the "DOUBLE PRECISION" type to an 8 byte wide.
217 @cindex option, -fdefault-integer-8
218 @cindex -fdefault-integer-8, option
219 @item -fdefault-integer-8
220 Set the default integer and logical types to an 8 byte wide type.
221 Do nothing if this is already the default.
223 @cindex option, -fdefault-real-8
224 @cindex -fdefault-real-8, option
225 @item -fdefault-real-8
226 Set the default real type to an 8 byte wide type.
227 Do nothing if this is already the default.
229 @cindex -fdollar-ok option
230 @cindex options, -fdollar-ok
234 @cindex character set
235 Allow @samp{$} as a valid character in a symbol name.
237 @cindex -fno-backslash option
238 @cindex options, -fno-backslash
241 @cindex escape characters
242 Compile switch to change the interpretation of a backslash from
243 ``C''-style escape characters to a single backslash character.
245 @cindex -ffixed-line-length-@var{n} option
246 @cindex options, -ffixed-line-length-@var{n}
247 @item -ffixed-line-length-@var{n}
248 @cindex source file format
249 @cindex lines, length
250 @cindex length of source lines
252 @cindex limits, lengths of source lines
253 Set column after which characters are ignored in typical fixed-form
254 lines in the source file, and through which spaces are assumed (as
255 if padded to that length) after the ends of short fixed-form lines.
258 @cindex extended-source option
259 Popular values for @var{n} include 72 (the
260 standard and the default), 80 (card image), and 132 (corresponds
261 to ``extended-source'' options in some popular compilers).
262 @var{n} may be @samp{none}, meaning that the entire line is meaningful
263 and that continued character constants never have implicit spaces appended
264 to them to fill out the line.
265 @option{-ffixed-line-length-0} means the same thing as
266 @option{-ffixed-line-length-none}.
268 @cindex -ffree-line-length-@var{n} option
269 @cindex options, -ffree-line-length-@var{n}
270 @item -ffree-line-length-@var{n}
271 @cindex source file format
272 @cindex lines, length
273 @cindex length of source lines
275 @cindex limits, lengths of source lines
276 Set column after which characters are ignored in typical free-form
277 lines in the source file. For free-form, the default value is 132.
278 @var{n} may be @samp{none}, meaning that the entire line is meaningful.
279 @option{-ffree-line-length-0} means the same thing as
280 @option{-ffree-line-length-none}.
282 @cindex -fmax-identifier-length=@var{n} option
283 @cindex option -fmax-identifier-length=@var{n}
284 @item -fmax-identifier-length=@var{n}
285 Specify the maximum allowed identifier length. Typical values are
286 31 (Fortran 95) and 63 (Fortran 200x).
288 @cindex -fimplicit-none option
289 @cindex options, -fimplicit-none
290 @item -fimplicit-none
291 Specify that no implicit typing is allowed, unless overridden by explicit
292 @samp{IMPLICIT} statements. This is the equivalent of adding
293 @samp{implicit none} to the start of every procedure.
295 @cindex -fcray-pointer option
296 @cindex options, -fcray-pointer
298 Enables the Cray pointer extension, which provides a C-like pointer.
301 @cindex options, -fopenmp
303 Enables handling of OpenMP @code{!$omp} directives in free form
304 and @code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
305 enables @code{!$} conditional compilation sentinels in free form
306 and @code{c$}, @code{*$} and @code{!$} sentinels in fixed form
307 and when linking arranges for the OpenMP runtime library to be linked
310 @cindex -std=@var{std} option
311 @cindex option, -std=@var{std}
313 Conform to the specified standard. Allowed values for @var{std} are
314 @samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
318 @node Warning Options
319 @section Options to Request or Suppress Warnings
320 @cindex options, warnings
321 @cindex warnings, suppressing
322 @cindex messages, warning
323 @cindex suppressing warnings
325 Warnings are diagnostic messages that report constructions which
326 are not inherently erroneous but which are risky or suggest there
327 might have been an error.
329 You can request many specific warnings with options beginning @option{-W},
330 for example @option{-Wimplicit} to request warnings on implicit
331 declarations. Each of these specific warning options also has a
332 negative form beginning @option{-Wno-} to turn off warnings;
333 for example, @option{-Wno-implicit}. This manual lists only one of the
334 two forms, whichever is not the default.
336 These options control the amount and kinds of warnings produced by GNU
340 @cindex syntax checking
341 @cindex -fsyntax-only option
342 @cindex options, -fsyntax-only
344 Check the code for syntax errors, but don't do anything beyond that.
346 @cindex -pedantic option
347 @cindex options, -pedantic
349 Issue warnings for uses of extensions to FORTRAN 95.
350 @option{-pedantic} also applies to C-language constructs where they
351 occur in GNU Fortran source files, such as use of @samp{\e} in a
352 character constant within a directive like @samp{#include}.
354 Valid FORTRAN 95 programs should compile properly with or without
356 However, without this option, certain GNU extensions and traditional
357 Fortran features are supported as well.
358 With this option, many of them are rejected.
360 Some users try to use @option{-pedantic} to check programs for conformance.
361 They soon find that it does not do quite what they want---it finds some
362 nonstandard practices, but not all.
363 However, improvements to @command{gfortran} in this area are welcome.
365 This should be used in conjunction with -std=@var{std}.
367 @cindex -pedantic-errors option
368 @cindex options, -pedantic-errors
369 @item -pedantic-errors
370 Like @option{-pedantic}, except that errors are produced rather than
376 Inhibit all warning messages.
380 @cindex options, -Wall
383 @cindex warnings, all
384 Enables commonly used warning options pertaining to usage that
385 we recommend avoiding and that we believe are easy to avoid.
386 This currently includes @option{-Wunused-labels}, @option{-Waliasing},
387 @option{-Wampersand}, @option{-Wsurprising}, @option{-Wnonstd-intrinsic},
388 @option{-Wno-tabs}, and @option{-Wline-truncation}.
391 @cindex -Waliasing option
392 @cindex options, -Waliasing
395 Warn about possible aliasing of dummy arguments. Specifically, it warns
396 if the same actual argument is associated with a dummy argument with
397 @code{intent(in)} and a dummy argument with @code{intent(out)} in a call
398 with an explicit interface.
400 The following example will trigger the warning.
404 integer, intent(in) :: a
405 integer, intent(out) :: b
414 @cindex -Wampersand option
415 @cindex options, -Wampersand
418 Warn about missing ampersand in continued character constants. The warning is
419 given with @option{-Wampersand}, @option{-pedantic}, @option{-std=f95}, and
420 @option{-std=f2003}. Note: With no ampersand given in a continued character
421 constant, gfortran assumes continuation at the first non-comment,
422 non-whitespace character after the ampersand that initiated the continuation.
425 @cindex -Wconversion option
426 @cindex options, -Wconversion
429 Warn about implicit conversions between different types.
432 @cindex -Wimplicit-interface option
433 @cindex options, -Wimplicit-interface
434 @item -Wimplicit-interface
435 Warn about when procedure are called without an explicit interface.
436 Note this only checks that an explicit interface is present. It does not
437 check that the declared interfaces are consistent across program units.
440 @cindex -Wnonstd-intrinsic option
441 @cindex options, -Wnonstd-intrinsic
442 @item -Wnonstd-intrinsic
443 Warn if the user tries to use an intrinsic that does not belong to the
444 standard the user has chosen via the -std option.
448 @cindex options, -Wsurprising
451 Produce a warning when ``suspicious'' code constructs are encountered.
452 While technically legal these usually indicate that an error has been made.
454 This currently produces a warning under the following circumstances:
458 An INTEGER SELECT construct has a CASE that can never be matched as its
459 lower value is greater than its upper value.
462 A LOGICAL SELECT construct has three CASE statements.
467 @cindex options, -Wtabs
470 By default, tabs are accepted as whitespace, but tabs are not members
471 of the Fortran Character Set. @option{-Wno-tabs} will cause a warning
472 to be issued if a tab is encountered. Note, @option{-Wno-tabs} is active
473 for @option{-pedantic}, @option{-std=f95}, and @option{-Wall}.
477 @cindex options, -Wunderflow
480 Produce a warning when numerical constant expressions are
481 encountered, which yield an UNDERFLOW during compilation.
484 @cindex -Wunused-labels option
485 @cindex options, -Wunused-labels
486 @item -Wunused-labels
487 @cindex unused labels
488 @cindex labels, unused
489 Warn whenever a label is defined but never referenced.
493 @cindex options, -Werror
495 Turns all warnings into errors.
501 @cindex extra warnings
502 @cindex warnings, extra
503 Turns on ``extra warnings'' and, if optimization is specified
504 via @option{-O}, the @option{-Wuninitialized} option.
505 (This might change in future versions of @command{gfortran}
508 @xref{Warning Options,,Options to Request or Suppress Warnings,
509 gcc,Using the GNU Compiler Collection (GCC)}, for information on more
510 options offered by the GBE shared by @command{gfortran}, @command{gcc} and
513 Some of these have no effect when compiling programs written in Fortran.
515 @node Debugging Options
516 @section Options for Debugging Your Program or GNU Fortran
517 @cindex options, debugging
518 @cindex debugging information options
520 GNU Fortran has various special options that are used for debugging
521 either your program or @command{gfortran}
524 @cindex -fdump-parse-tree option
525 @cindex option, -fdump-parse-tree
526 @item -fdump-parse-tree
527 Output the internal parse tree before starting code generation. Only
528 really useful for debugging gfortran itself.
532 @cindex -ffpe-trap=@var{list} option
533 @cindex option, -ffpe-trap=@var{list}
534 @item -ffpe-trap=@var{list}
535 Specify a list of IEEE exceptions when a Floating Point Exception
536 (FPE) should be raised. On most systems, this will result in a SIGFPE
537 signal being sent and the program being interrupted, producing a core
538 file useful for debugging. @var{list} is a (possibly empty) comma-separated
539 list of the following IEEE exceptions: @samp{invalid} (invalid floating
540 point operation, such as @code{sqrt(-1.0)}), @samp{zero} (division by
541 zero), @samp{overflow} (overflow in a floating point operation),
542 @samp{underflow} (underflow in a floating point operation),
543 @samp{precision} (loss of precision during operation) and @samp{denormal}
544 (operation produced a denormal denormal value).
547 @xref{Debugging Options,,Options for Debugging Your Program or GCC,
548 gcc,Using the GNU Compiler Collection (GCC)}, for more information on
551 @node Directory Options
552 @section Options for Directory Search
553 @cindex directory, options
554 @cindex options, directory search
557 @cindex INCLUDE directive
558 @cindex directive, INCLUDE
559 These options affect how @command{gfortran} searches
560 for files specified by the @code{INCLUDE} directive and where it searches
561 for previously compiled modules.
563 It also affects the search paths used by @command{cpp} when used to preprocess
568 @cindex options, -Idir
570 @cindex directory, search paths for inclusion
571 @cindex inclusion, directory search paths for
572 @cindex search paths, for included files
573 @cindex paths, search
574 @cindex module search path
575 These affect interpretation of the @code{INCLUDE} directive
576 (as well as of the @code{#include} directive of the @command{cpp}
579 Also note that the general behavior of @option{-I} and
580 @code{INCLUDE} is pretty much the same as of @option{-I} with
581 @code{#include} in the @command{cpp} preprocessor, with regard to
582 looking for @file{header.gcc} files and other such things.
584 This path is also used to search for @samp{.mod} files when previously
585 compiled modules are required by a @code{USE} statement.
587 @xref{Directory Options,,Options for Directory Search,
588 gcc,Using the GNU Compiler Collection (GCC)}, for information on the
592 @cindex option, -Mdir
595 This option specifies where to put @samp{.mod} files for compiled modules.
596 It is also added to the list of directories to searched by an @code{USE}
599 The default is the current directory.
601 @option{-J} is an alias for @option{-M} to avoid conflicts with existing
605 @node Runtime Options
606 @section Influencing runtime behavior
607 @cindex runtime, options
609 These options affect the runtime behavior of @command{gfortran}.
611 @cindex -fconvert=@var{conversion} option
612 @item -fconvert=@var{conversion}
613 Specify the representation of data for unformatted files. Valid
614 values for conversion are: @samp{native}, the default; @samp{swap},
615 swap between big- and little-endian; @samp{big-endian}, use big-endian
616 representation for unformatted files; @samp{little-endian}, use little-endian
617 representation for unformatted files.
619 @emph{This option has an effect only when used in the main program.
620 The @code{CONVERT} specifier and the GFORTRAN_CONVERT_UNIT environment
621 variable override the default specified by -fconvert.}
623 @cindex -frecord-marker=@var{length}
624 @item -frecord-marker=@var{length}
625 Specify the length of record markers for unformatted files.
626 Valid values for @var{length} are 4 and 8. Default is whatever
627 @code{off_t} is specified to be on that particular system.
628 Note that specifying @var{length} as 4 limits the record
629 length of unformatted files to 2 GB. This option does not
630 extend the maximum possible record length on systems where
631 @code{off_t} is a four_byte quantity.
635 @node Code Gen Options
636 @section Options for Code Generation Conventions
637 @cindex code generation, conventions
638 @cindex options, code generation
639 @cindex run-time, options
641 These machine-independent options control the interface conventions
642 used in code generation.
644 Most of them have both positive and negative forms; the negative form
645 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
646 one of the forms is listed---the one which is not the default. You
647 can figure out the other form by either removing @option{no-} or adding
651 @cindex @option{-fno-automatic} option
652 @cindex options, @option{-fno-automatic}
654 @cindex SAVE statement
655 @cindex statements, SAVE
656 Treat each program unit as if the @code{SAVE} statement was specified for
657 every local variable and array referenced in it. Does not affect common
658 blocks. (Some Fortran compilers provide this option under the name
661 @cindex @option{-ff2c} option
662 @cindex options, @option{-ff2c}
664 @cindex calling convention
665 @cindex @command{f2c} calling convention
666 @cindex @command{g77} calling convention
667 @cindex libf2c calling convention
668 Generate code designed to be compatible with code generated
669 by @command{g77} and @command{f2c}.
671 The calling conventions used by @command{g77} (originally implemented
672 in @command{f2c}) require functions that return type
673 default @code{REAL} to actually return the C type @code{double}, and
674 functions that return type @code{COMPLEX} to return the values via an
675 extra argument in the calling sequence that points to where to
676 store the return value. Under the default GNU calling conventions, such
677 functions simply return their results as they would in GNU
678 C -- default @code{REAL} functions return the C type @code{float}, and
679 @code{COMPLEX} functions return the GNU C type @code{complex}.
680 Additionally, this option implies the @option{-fsecond-underscore}
681 option, unless @option{-fno-second-underscore} is explicitly requested.
683 This does not affect the generation of code that interfaces with
684 the @command{libgfortran} library.
686 @emph{Caution:} It is not a good idea to mix Fortran code compiled
687 with @code{-ff2c} with code compiled with the default @code{-fno-f2c}
688 calling conventions as, calling @code{COMPLEX} or default @code{REAL}
689 functions between program parts which were compiled with different
690 calling conventions will break at execution time.
692 @emph{Caution:} This will break code which passes intrinsic functions
693 of type default @code{REAL} or @code{COMPLEX} as actual arguments, as
694 the library implementations use the @command{-fno-f2c} calling conventions.
696 @cindex @option{-fno-underscoring option}
697 @cindex options, @option{-fno-underscoring}
698 @item -fno-underscoring
700 @cindex symbol names, underscores
701 @cindex transforming symbol names
702 @cindex symbol names, transforming
703 Do not transform names of entities specified in the Fortran
704 source file by appending underscores to them.
706 With @option{-funderscoring} in effect, @command{gfortran} appends one
707 underscore to external names with no underscores. This is done to ensure
708 compatibility with code produced by many UNIX Fortran compilers.
710 @emph{Caution}: The default behavior of @command{gfortran} is
711 incompatible with @command{f2c} and @command{g77}, please use the
712 @option{-ff2c} option if you want object files compiled with
713 @option{gfortran} to be compatible with object code created with these
716 Use of @option{-fno-underscoring} is not recommended unless you are
717 experimenting with issues such as integration of (GNU) Fortran into
718 existing system environments (vis-a-vis existing libraries, tools, and
721 For example, with @option{-funderscoring}, and assuming other defaults like
722 @option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
723 external functions while @samp{my_var} and @samp{lvar} are local variables,
727 I = J() + MAX_COUNT (MY_VAR, LVAR)
731 is implemented as something akin to:
734 i = j_() + max_count__(&my_var__, &lvar);
737 With @option{-fno-underscoring}, the same statement is implemented as:
740 i = j() + max_count(&my_var, &lvar);
743 Use of @option{-fno-underscoring} allows direct specification of
744 user-defined names while debugging and when interfacing @command{gfortran}
745 code with other languages.
747 Note that just because the names match does @emph{not} mean that the
748 interface implemented by @command{gfortran} for an external name matches the
749 interface implemented by some other language for that same name.
750 That is, getting code produced by @command{gfortran} to link to code produced
751 by some other compiler using this or any other method can be only a
752 small part of the overall solution---getting the code generated by
753 both compilers to agree on issues other than naming can require
754 significant effort, and, unlike naming disagreements, linkers normally
755 cannot detect disagreements in these other areas.
757 Also, note that with @option{-fno-underscoring}, the lack of appended
758 underscores introduces the very real possibility that a user-defined
759 external name will conflict with a name in a system library, which
760 could make finding unresolved-reference bugs quite difficult in some
761 cases---they might occur at program run time, and show up only as
762 buggy behavior at run time.
764 In future versions of @command{gfortran} we hope to improve naming and linking
765 issues so that debugging always involves using the names as they appear
766 in the source, even if the names as seen by the linker are mangled to
767 prevent accidental linking between procedures with incompatible
770 @cindex @option{-fsecond-underscore option}
771 @cindex options, @option{-fsecond-underscore}
772 @item -fsecond-underscore
774 @cindex symbol names, underscores
775 @cindex transforming symbol names
776 @cindex symbol names, transforming
777 @cindex @command{f2c} calling convention
778 @cindex @command{g77} calling convention
779 @cindex libf2c calling convention
780 By default, @command{gfortran} appends an underscore to external
781 names. If this option is used @command{gfortran} appends two
782 underscores to names with underscores and one underscore to external names
783 with no underscores. (@command{gfortran} also appends two underscores to
784 internal names with underscores to avoid naming collisions with external
787 This option has no effect if @option{-fno-underscoring} is
788 in effect. It is implied by the @option{-ff2c} option.
790 Otherwise, with this option, an external name such as @samp{MAX_COUNT}
791 is implemented as a reference to the link-time external symbol
792 @samp{max_count__}, instead of @samp{max_count_}. This is required
793 for compatibility with @command{g77} and @command{f2c}, and is implied
794 by use of the @option{-ff2c} option.
797 @cindex -fbounds-check option
798 @cindex -ffortran-bounds-check option
800 @cindex bounds checking
801 @cindex range checking
802 @cindex array bounds checking
803 @cindex subscript checking
804 @cindex checking subscripts
805 Enable generation of run-time checks for array subscripts
806 and against the declared minimum and maximum values. It also
807 checks array indices for assumed and deferred
808 shape arrays against the actual allocated bounds.
810 In the future this may also include other forms of checking, eg. checking
811 substring references.
814 @cindex -fmax-stack-var-size option
815 @item -fmax-stack-var-size=@var{n}
816 This option specifies the size in bytes of the largest array that will be put
819 This option currently only affects local arrays declared with constant
820 bounds, and may not apply to all character variables.
821 Future versions of @command{gfortran} may improve this behavior.
823 The default value for @var{n} is 32768.
825 @cindex -fpackderived
827 @cindex Structure packing
828 This option tells gfortran to pack derived type members as closely as
829 possible. Code compiled with this option is likely to be incompatible
830 with code compiled without this option, and may execute slower.
832 @cindex -frepack-arrays option
833 @item -frepack-arrays
834 @cindex Repacking arrays
835 In some circumstances @command{gfortran} may pass assumed shape array
836 sections via a descriptor describing a discontiguous area of memory.
837 This option adds code to the function prologue to repack the data into
838 a contiguous block at runtime.
840 This should result in faster accesses to the array. However it can introduce
841 significant overhead to the function call, especially when the passed data
844 @cindex -fshort-enums
846 This option is provided for interoperability with C code that was
847 compiled with the @command{-fshort-enums} option. It will make
848 @command{gfortran} choose the smallest @code{INTEGER} kind a given
849 enumerator set will fit in, and give all its enumerators this kind.
852 @xref{Code Gen Options,,Options for Code Generation Conventions,
853 gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
855 shared by @command{gfortran} @command{gcc} and other GNU compilers.
860 @node Environment Variables
861 @section Environment Variables Affecting GNU Fortran
862 @cindex environment variables
864 @c man begin ENVIRONMENT
866 GNU Fortran 95 currently does not make use of any environment
867 variables to control its operation above and beyond those
868 that affect the operation of @command{gcc}.
870 @xref{Environment Variables,,Environment Variables Affecting GCC,
871 gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
874 @xref{Runtime}, for environment variables that affect the
875 run-time behavior of @command{gfortran} programs.