2006-01-16 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / fortran / invoke.texi
blob5816207d4a6b798930e1e88d017d447e5ab03121
1 @c Copyright (C) 2004, 2005
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.
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 2004, 2005
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:
21      A GNU Manual
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.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gfortran
31 @settitle GNU Fortran 95 compiler.
32 @c man begin SYNOPSIS
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
43 remainder.
44 @c man end
45 @c man begin SEEALSO
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}.
50 @c man end
51 @c man begin BUGS
52 For instructions on reporting bugs, see
53 @w{@uref{http://gcc.gnu.org/bugs.html}}.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gfortran} for contributors to GCC and
57 GFORTRAN@.
58 @c man end
59 @end ignore
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.
91 @c man end
93 @menu
94 * Option Summary::      Brief list of all @command{gfortran} options,
95                         without explanations.
96 * Fortran Dialect Options::  Controlling the variant of Fortran language
97                              compiled.
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 * Code Gen Options::    Specifying conventions for function calls, data layout
102                         and register usage.
103 * Environment Variables:: Env vars that affect GNU Fortran.
104 @end menu
106 @node Option Summary
107 @section Option Summary
109 @c man begin OPTIONS
111 Here is a summary of all the options specific to GNU Fortran, grouped
112 by type.  Explanations are in the following sections.
114 @table @emph
115 @item Fortran Language Options
116 @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
117 @gccoptlist{
118 -ffree-form  -fno-fixed-form @gol
119 -fdollar-ok  -fimplicit-none  -fmax-identifier-length @gol
120 -std=@var{std} -fd-lines-as-code -fd-lines-as-comments @gol
121 -ffixed-line-length-@var{n}  -ffixed-line-length-none @gol
122 -ffree-line-length-@var{n}  -ffree-line-length-none @gol
123 -fdefault-double-8  -fdefault-integer-8  -fdefault-real-8 @gol
124 -fcray-pointer }
126 @item Warning Options
127 @xref{Warning Options,,Options to Request or Suppress Warnings}.
128 @gccoptlist{
129 -fsyntax-only  -pedantic  -pedantic-errors @gol
130 -w  -Wall  -Waliasing  -Wconversion @gol
131 -Wimplicit-interface  -Wnonstd-intrinsics  -Wsurprising  -Wunderflow @gol
132 -Wunused-labels -Wline-truncation -W}
134 @item Debugging Options
135 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
136 @gccoptlist{
137 -fdump-parse-tree -ffpe-trap=@var{list}}
139 @item Directory Options
140 @xref{Directory Options,,Options for Directory Search}.
141 @gccoptlist{
142 -I@var{dir}  -M@var{dir}}
144 @item Code Generation Options
145 @xref{Code Gen Options,,Options for Code Generation Conventions}.
146 @gccoptlist{
147 -fno-automatic -ff2c -fno-underscoring  -fsecond-underscore @gol
148 -fbounds-check  -fmax-stack-var-size=@var{n} @gol
149 -fpackderived  -frepack-arrays  -fshort-enums}
150 @end table
152 @menu
153 * Fortran Dialect Options::  Controlling the variant of Fortran language
154                              compiled.
155 * Warning Options::     How picky should the compiler be?
156 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
157 * Directory Options::   Where to find module files
158 * Code Gen Options::    Specifying conventions for function calls, data layout
159                         and register usage.
160 @end menu
162 @node Fortran Dialect Options
163 @section Options Controlling Fortran Dialect
164 @cindex dialect options
165 @cindex language, dialect options
166 @cindex options, dialect
168 The following options control the dialect of Fortran
169 that the compiler accepts:
171 @table @gcctabopt
172 @cindex -ffree-form option
173 @cindex options, -ffree-form
174 @cindex -fno-fixed-form option
175 @cindex options, -fno-fixed-form
176 @cindex source file format
177 @cindex free form
178 @cindex fixed form
179 @cindex Source Form
180 @cindex Fortran 90, features
181 @item -ffree-form
182 @item -ffixed-form
183 Specify the layout used by the source file.  The free form layout
184 was introduced in Fortran 90.  Fixed form was traditionally used in
185 older Fortran programs.
187 @cindex option, -fd-lines-as-code
188 @cindex -fd-lines-as-code, option
189 @cindex option, -fd-lines-as-comments
190 @cindex -fd-lines-as-comments, option
191 @item -fd-lines-as-code
192 @item -fd-lines-as-comment
193 Enables special treating for lines with @samp{d} or @samp{D} in fixed
194 form sources.  If the @option{-fd-lines-as-code} option is given
195 they are treated as if the first column contained a blank.  If the
196 @option{-fd-lines-as-comments} option is given, they are treated as
197 comment lines.
199 @cindex option, -fdefault-double-8
200 @cindex -fdefault-double-8, option
201 @item -fdefault-double-8
202 Set the "DOUBLE PRECISION" type to an 8 byte wide.
204 @cindex option, -fdefault-integer-8
205 @cindex -fdefault-integer-8, option
206 @item -fdefault-integer-8
207 Set the default integer and logical types to an 8 byte wide type.
208 Do nothing if this is already the default.
210 @cindex option, -fdefault-real-8
211 @cindex -fdefault-real-8, option
212 @item -fdefault-real-8
213 Set the default real type to an 8 byte wide type.
214 Do nothing if this is already the default.
216 @cindex -fdollar-ok option
217 @cindex options, -fdollar-ok
218 @item -fdollar-ok
219 @cindex dollar sign
220 @cindex symbol names
221 @cindex character set
222 Allow @samp{$} as a valid character in a symbol name.
224 @cindex -fno-backslash option
225 @cindex options, -fno-backslash
226 @item -fno-backslash
227 @cindex backslash
228 @cindex escape characters
229 Compile switch to change the interpretation of a backslash from
230 ``C''-style escape characters to a single backslash character.
232 @cindex -ffixed-line-length-@var{n} option
233 @cindex options, -ffixed-line-length-@var{n}
234 @item -ffixed-line-length-@var{n}
235 @cindex source file format
236 @cindex lines, length
237 @cindex length of source lines
238 @cindex fixed form
239 @cindex limits, lengths of source lines
240 Set column after which characters are ignored in typical fixed-form
241 lines in the source file, and through which spaces are assumed (as
242 if padded to that length) after the ends of short fixed-form lines.
244 @cindex card image
245 @cindex extended-source option
246 Popular values for @var{n} include 72 (the
247 standard and the default), 80 (card image), and 132 (corresponds
248 to ``extended-source'' options in some popular compilers).
249 @var{n} may be @samp{none}, meaning that the entire line is meaningful
250 and that continued character constants never have implicit spaces appended
251 to them to fill out the line.
252 @option{-ffixed-line-length-0} means the same thing as
253 @option{-ffixed-line-length-none}.
255 @cindex -ffree-line-length-@var{n} option
256 @cindex options, -ffree-line-length-@var{n}
257 @item -ffree-line-length-@var{n}
258 @cindex source file format
259 @cindex lines, length
260 @cindex length of source lines
261 @cindex free form
262 @cindex limits, lengths of source lines
263 Set column after which characters are ignored in typical free-form
264 lines in the source file. For free-form, the default value is 132.
265 @var{n} may be @samp{none}, meaning that the entire line is meaningful.
266 @option{-ffree-line-length-0} means the same thing as
267 @option{-ffree-line-length-none}.
269 @cindex -fmax-identifier-length=@var{n} option
270 @cindex option -fmax-identifier-length=@var{n}
271 @item -fmax-identifier-length=@var{n}
272 Specify the maximum allowed identifier length. Typical values are
273 31 (Fortran 95) and 63 (Fortran 200x).
275 @cindex -fimplicit-none option
276 @cindex options, -fimplicit-none
277 @item -fimplicit-none
278 Specify that no implicit typing is allowed, unless overridden by explicit
279 @samp{IMPLICIT} statements.  This is the equivalent of adding
280 @samp{implicit none} to the start of every procedure.
282 @cindex -fcray-pointer option
283 @cindex options, -fcray-pointer
284 @item -fcray-pointer
285 Enables the Cray pointer extension, which provides a C-like pointer.
287 @cindex -std=@var{std} option
288 @cindex option, -std=@var{std}
289 @item -std=@var{std}
290 Conform to the specified standard.  Allowed values for @var{std} are
291 @samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
293 @end table
295 @node Warning Options
296 @section Options to Request or Suppress Warnings
297 @cindex options, warnings
298 @cindex warnings, suppressing
299 @cindex messages, warning
300 @cindex suppressing warnings
302 Warnings are diagnostic messages that report constructions which
303 are not inherently erroneous but which are risky or suggest there
304 might have been an error.
306 You can request many specific warnings with options beginning @option{-W},
307 for example @option{-Wimplicit} to request warnings on implicit
308 declarations.  Each of these specific warning options also has a
309 negative form beginning @option{-Wno-} to turn off warnings;
310 for example, @option{-Wno-implicit}.  This manual lists only one of the
311 two forms, whichever is not the default.
313 These options control the amount and kinds of warnings produced by GNU
314 Fortran:
316 @table @gcctabopt
317 @cindex syntax checking
318 @cindex -fsyntax-only option
319 @cindex options, -fsyntax-only
320 @item -fsyntax-only
321 Check the code for syntax errors, but don't do anything beyond that.
323 @cindex -pedantic option
324 @cindex options, -pedantic
325 @item -pedantic
326 Issue warnings for uses of extensions to FORTRAN 95.
327 @option{-pedantic} also applies to C-language constructs where they
328 occur in GNU Fortran source files, such as use of @samp{\e} in a
329 character constant within a directive like @samp{#include}.
331 Valid FORTRAN 95 programs should compile properly with or without
332 this option.
333 However, without this option, certain GNU extensions and traditional
334 Fortran features are supported as well.
335 With this option, many of them are rejected.
337 Some users try to use @option{-pedantic} to check programs for conformance.
338 They soon find that it does not do quite what they want---it finds some
339 nonstandard practices, but not all.
340 However, improvements to @command{gfortran} in this area are welcome.
342 This should be used in conjunction with -std=@var{std}.
344 @cindex -pedantic-errors option
345 @cindex options, -pedantic-errors
346 @item -pedantic-errors
347 Like @option{-pedantic}, except that errors are produced rather than
348 warnings.
350 @cindex -w option
351 @cindex options, -w
352 @item -w
353 Inhibit all warning messages.
356 @cindex -Wall option
357 @cindex options, -Wall
358 @item -Wall
359 @cindex all warnings
360 @cindex warnings, all
361 Enables commonly used warning options that which pertain to usage that
362 we recommend avoiding and that we believe is easy to avoid.
363 This currently includes @option{-Wunused-labels}, @option{-Waliasing},
364 @option{-Wsurprising}, @option{-Wnonstd-intrinsic} and
365 @option{-Wline-truncation}.
368 @cindex -Waliasing option
369 @cindex options, -Waliasing
370 @item -Waliasing
371 @cindex aliasing
372 Warn about possible aliasing of dummy arguments. Specifically, it warns
373 if the same actual argument is associated with a dummy argument with
374 @code{intent(in)} and a dummy argument with @code{intent(out)} in a call
375 with an explicit interface.
377 The following example will trigger the warning.
378 @smallexample
379   interface
380     subroutine bar(a,b)
381       integer, intent(in) :: a
382       integer, intent(out) :: b
383     end subroutine
384   end interface
385   integer :: a
387   call bar(a,a)
388 @end smallexample
391 @cindex -Wconversion option
392 @cindex options, -Wconversion
393 @item -Wconversion
394 @cindex conversion
395 Warn about implicit conversions between different types.
398 @cindex -Wimplicit-interface option
399 @cindex options, -Wimplicit-interface
400 @item -Wimplicit-interface
401 Warn about when procedure are called without an explicit interface.
402 Note this only checks that an explicit interface is present.  It does not
403 check that the declared interfaces are consistent across program units.
406 @cindex -Wnonstd-intrinsic option
407 @cindex options, -Wnonstd-intrinsic
408 @item -Wnonstd-intrinsic
409 Warn if the user tries to use an intrinsic that does not belong to the 
410 standard the user has chosen via the -std option.
413 @cindex -Wsurprising
414 @cindex options, -Wsurprising
415 @item -Wsurprising
416 @cindex Suspicious
417 Produce a warning when ``suspicious'' code constructs are encountered.
418 While technically legal these usually indicate that an error has been made.
420 This currently produces a warning under the following circumstances:
422 @itemize @bullet
423 @item
424 An INTEGER SELECT construct has a CASE that can never be matched as its
425 lower value is greater than its upper value.
427 @item
428 A LOGICAL SELECT construct has three CASE statements.
429 @end itemize
431 @cindex -Wunderflow
432 @cindex options, -Wunderflow
433 @item -Wunderflow
434 @cindex UNDERFLOW
435 Produce a warning when numerical constant expressions are
436 encountered, which yield an UNDERFLOW during compilation.
439 @cindex -Wunused-labels option
440 @cindex options, -Wunused-labels
441 @item -Wunused-labels
442 @cindex unused labels
443 @cindex labels, unused
444 Warn whenever a label is defined but never referenced.
447 @cindex -Werror
448 @cindex options, -Werror
449 @item -Werror
450 Turns all warnings into errors.
453 @cindex -W option
454 @cindex options, -W
455 @item -W
456 @cindex extra warnings
457 @cindex warnings, extra
458 Turns on ``extra warnings'' and, if optimization is specified
459 via @option{-O}, the @option{-Wuninitialized} option.
460 (This might change in future versions of @command{gfortran}
461 @end table
463 @xref{Warning Options,,Options to Request or Suppress Warnings,
464 gcc,Using the GNU Compiler Collection (GCC)}, for information on more
465 options offered by the GBE shared by @command{gfortran}, @command{gcc} and
466 other GNU compilers.
468 Some of these have no effect when compiling programs written in Fortran.
470 @node Debugging Options
471 @section Options for Debugging Your Program or GNU Fortran
472 @cindex options, debugging
473 @cindex debugging information options
475 GNU Fortran has various special options that are used for debugging
476 either your program or @command{gfortran}
478 @table @gcctabopt
479 @cindex -fdump-parse-tree option
480 @cindex option, -fdump-parse-tree
481 @item -fdump-parse-tree
482 Output the internal parse tree before starting code generation.  Only
483 really useful for debugging gfortran itself.
484 @end table
486 @table @gcctabopt
487 @cindex -ffpe-trap=@var{list} option
488 @cindex option, -ffpe-trap=@var{list}
489 @item -ffpe-trap=@var{list}
490 Specify a list of IEEE exceptions when a Floating Point Exception
491 (FPE) should be raised.  On most systems, this will result in a SIGFPE
492 signal being sent and the program being interrupted, producing a core
493 file useful for debugging.  @var{list} is a (possibly empty) comma-separated
494 list of the following IEEE exceptions: @samp{invalid} (invalid floating
495 point operation, such as @code{sqrt(-1.0)}), @samp{zero} (division by
496 zero), @samp{overflow} (overflow in a floating point operation),
497 @samp{underflow} (underflow in a floating point operation),
498 @samp{precision} (loss of precision during operation) and @samp{denormal}
499 (operation produced a denormal denormal value).
500 @end table
502 @xref{Debugging Options,,Options for Debugging Your Program or GCC,
503 gcc,Using the GNU Compiler Collection (GCC)}, for more information on
504 debugging options.
506 @node Directory Options
507 @section Options for Directory Search
508 @cindex directory, options
509 @cindex options, directory search
510 @cindex search path
512 @cindex INCLUDE directive
513 @cindex directive, INCLUDE
514 These options affect how @command{gfortran} searches
515 for files specified by the @code{INCLUDE} directive and where it searches
516 for previously compiled modules.
518 It also affects the search paths used by @command{cpp} when used to preprocess
519 Fortran source.
521 @table @gcctabopt
522 @cindex -Idir option
523 @cindex options, -Idir
524 @item -I@var{dir}
525 @cindex directory, search paths for inclusion
526 @cindex inclusion, directory search paths for
527 @cindex search paths, for included files
528 @cindex paths, search
529 @cindex module search path
530 These affect interpretation of the @code{INCLUDE} directive
531 (as well as of the @code{#include} directive of the @command{cpp}
532 preprocessor).
534 Also note that the general behavior of @option{-I} and
535 @code{INCLUDE} is pretty much the same as of @option{-I} with
536 @code{#include} in the @command{cpp} preprocessor, with regard to
537 looking for @file{header.gcc} files and other such things.
539 This path is also used to search for @samp{.mod} files when previously
540 compiled modules are required by a @code{USE} statement.
542 @xref{Directory Options,,Options for Directory Search,
543 gcc,Using the GNU Compiler Collection (GCC)}, for information on the
544 @option{-I} option.
546 @cindex -Mdir option
547 @cindex option, -Mdir
548 @item -M@var{dir}
549 @item -J@var{dir}
550 This option specifies where to put @samp{.mod} files for compiled modules.
551 It is also added to the list of directories to searched by an @code{USE}
552 statement.
554 The default is the current directory.
556 @option{-J} is an alias for @option{-M} to avoid conflicts with existing
557 GCC options.
558 @end table
560 @node Code Gen Options
561 @section Options for Code Generation Conventions
562 @cindex code generation, conventions
563 @cindex options, code generation
564 @cindex run-time, options
566 These machine-independent options control the interface conventions
567 used in code generation.
569 Most of them have both positive and negative forms; the negative form
570 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
571 one of the forms is listed---the one which is not the default.  You
572 can figure out the other form by either removing @option{no-} or adding
575 @table @gcctabopt
576 @cindex @option{-fno-automatic} option
577 @cindex options, @option{-fno-automatic}
578 @item -fno-automatic
579 @cindex SAVE statement
580 @cindex statements, SAVE
581 Treat each program unit as if the @code{SAVE} statement was specified for
582 every local variable and array referenced in it. Does not affect common
583 blocks. (Some Fortran compilers provide this option under the name
584 @option{-static}.)
586 @cindex @option{-ff2c} option
587 @cindex options, @option{-ff2c}
588 @item -ff2c
589 @cindex calling convention
590 @cindex @command{f2c} calling convention
591 @cindex @command{g77} calling convention
592 @cindex libf2c calling convention
593 Generate code designed to be compatible with code generated
594 by @command{g77} and @command{f2c}.
596 The calling conventions used by @command{g77} (originally implemented
597 in @command{f2c}) require functions that return type
598 default @code{REAL} to actually return the C type @code{double}, and
599 functions that return type @code{COMPLEX} to return the values via an
600 extra argument in the calling sequence that points to where to
601 store the return value.  Under the default GNU calling conventions, such
602 functions simply return their results as they would in GNU
603 C -- default @code{REAL} functions return the C type @code{float}, and
604 @code{COMPLEX} functions return the GNU C type @code{complex}.
605 Additionally, this option implies the @option{-fsecond-underscore}
606 option, unless @option{-fno-second-underscore} is explicitly requested.
608 This does not affect the generation of code that interfaces with
609 the @command{libgfortran} library.
611 @emph{Caution:} It is not a good idea to mix Fortran code compiled
612 with @code{-ff2c} with code compiled with the default @code{-fno-f2c}
613 calling conventions as, calling @code{COMPLEX} or default @code{REAL}
614 functions between program parts which were compiled with different
615 calling conventions will break at execution time.
617 @emph{Caution:} This will break code which passes intrinsic functions
618 of type default @code{REAL} or @code{COMPLEX} as actual arguments, as
619 the library implementations use the @command{-fno-f2c} calling conventions.
621 @cindex @option{-fno-underscoring option}
622 @cindex options, @option{-fno-underscoring}
623 @item -fno-underscoring
624 @cindex underscore
625 @cindex symbol names, underscores
626 @cindex transforming symbol names
627 @cindex symbol names, transforming
628 Do not transform names of entities specified in the Fortran
629 source file by appending underscores to them.
631 With @option{-funderscoring} in effect, @command{gfortran} appends one
632 underscore to external names with no underscores.  This is done to ensure
633 compatibility with code produced by many UNIX Fortran compilers.
635 @emph{Caution}: The default behavior of @command{gfortran} is
636 incompatible with @command{f2c} and @command{g77}, please use the
637 @option{-ff2c} option if you want object files compiled with
638 @option{gfortran} to be compatible with object code created with these
639 tools.
641 Use of @option{-fno-underscoring} is not recommended unless you are
642 experimenting with issues such as integration of (GNU) Fortran into
643 existing system environments (vis-a-vis existing libraries, tools, and
644 so on).
646 For example, with @option{-funderscoring}, and assuming other defaults like
647 @option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
648 external functions while @samp{my_var} and @samp{lvar} are local variables,
649 a statement like
651 @smallexample
652 I = J() + MAX_COUNT (MY_VAR, LVAR)
653 @end smallexample
655 @noindent
656 is implemented as something akin to:
658 @smallexample
659 i = j_() + max_count__(&my_var__, &lvar);
660 @end smallexample
662 With @option{-fno-underscoring}, the same statement is implemented as:
664 @smallexample
665 i = j() + max_count(&my_var, &lvar);
666 @end smallexample
668 Use of @option{-fno-underscoring} allows direct specification of
669 user-defined names while debugging and when interfacing @command{gfortran}
670 code with other languages.
672 Note that just because the names match does @emph{not} mean that the
673 interface implemented by @command{gfortran} for an external name matches the
674 interface implemented by some other language for that same name.
675 That is, getting code produced by @command{gfortran} to link to code produced
676 by some other compiler using this or any other method can be only a
677 small part of the overall solution---getting the code generated by
678 both compilers to agree on issues other than naming can require
679 significant effort, and, unlike naming disagreements, linkers normally
680 cannot detect disagreements in these other areas.
682 Also, note that with @option{-fno-underscoring}, the lack of appended
683 underscores introduces the very real possibility that a user-defined
684 external name will conflict with a name in a system library, which
685 could make finding unresolved-reference bugs quite difficult in some
686 cases---they might occur at program run time, and show up only as
687 buggy behavior at run time.
689 In future versions of @command{gfortran} we hope to improve naming and linking
690 issues so that debugging always involves using the names as they appear
691 in the source, even if the names as seen by the linker are mangled to
692 prevent accidental linking between procedures with incompatible
693 interfaces.
695 @cindex @option{-fsecond-underscore option}
696 @cindex options, @option{-fsecond-underscore}
697 @item -fsecond-underscore
698 @cindex underscore
699 @cindex symbol names, underscores
700 @cindex transforming symbol names
701 @cindex symbol names, transforming
702 @cindex @command{f2c} calling convention
703 @cindex @command{g77} calling convention
704 @cindex libf2c calling convention
705 By default, @command{gfortran} appends an underscore to external
706 names.  If this option is used @command{gfortran} appends two
707 underscores to names with underscores and one underscore to external names
708 with no underscores.  (@command{gfortran} also appends two underscores to
709 internal names with underscores to avoid naming collisions with external
710 names.
712 This option has no effect if @option{-fno-underscoring} is
713 in effect.  It is implied by the @option{-ff2c} option.
715 Otherwise, with this option, an external name such as @samp{MAX_COUNT}
716 is implemented as a reference to the link-time external symbol
717 @samp{max_count__}, instead of @samp{max_count_}.  This is required
718 for compatibility with @command{g77} and @command{f2c}, and is implied
719 by use of the @option{-ff2c} option.
722 @cindex -fbounds-check option
723 @cindex -ffortran-bounds-check option
724 @item -fbounds-check
725 @cindex bounds checking
726 @cindex range checking
727 @cindex array bounds checking
728 @cindex subscript checking
729 @cindex checking subscripts
730 Enable generation of run-time checks for array subscripts
731 and against the declared minimum and maximum values.  It also
732 checks array indices for assumed and deferred
733 shape arrays against the actual allocated bounds.
735 In the future this may also include other forms of checking, eg. checking
736 substring references.
739 @cindex -fmax-stack-var-size option
740 @item -fmax-stack-var-size=@var{n}
741 This option specifies the size in bytes of the largest array that will be put
742 on the stack.
744 This option currently only affects local arrays declared with constant
745 bounds, and may not apply to all character variables.
746 Future versions of @command{gfortran} may improve this behavior.
748 The default value for @var{n} is 32768.
750 @cindex -fpackderived
751 @item -fpackderived
752 @cindex Structure packing
753 This option tells gfortran to pack derived type members as closely as
754 possible.  Code compiled with this option is likely to be incompatible
755 with code compiled without this option, and may execute slower.
757 @cindex -frepack-arrays option
758 @item -frepack-arrays
759 @cindex Repacking arrays
760 In some circumstances @command{gfortran} may pass assumed shape array
761 sections via a descriptor describing a discontiguous area of memory.
762 This option adds code to the function prologue to repack the data into
763 a contiguous block at runtime.
765 This should result in faster accesses to the array.  However it can introduce
766 significant overhead to the function call, especially  when the passed data
767 is discontiguous.
769 @cindex -fshort-enums
770 @item -fshort-enums
771 This option is provided for interoperability with C code that was
772 compiled with the @command{-fshort-enums} option.  It will make
773 @command{gfortran} choose the smallest @code{INTEGER} kind a given
774 enumerator set will fit in, and give all its enumerators this kind.
775 @end table
777 @xref{Code Gen Options,,Options for Code Generation Conventions,
778 gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
779 offered by the GBE
780 shared by @command{gfortran} @command{gcc} and other GNU compilers.
783 @c man end
785 @node Environment Variables
786 @section Environment Variables Affecting GNU Fortran
787 @cindex environment variables
789 @c man begin ENVIRONMENT
791 GNU Fortran 95 currently does not make use of any environment
792 variables to control its operation above and beyond those
793 that affect the operation of @command{gcc}.
795 @xref{Environment Variables,,Environment Variables Affecting GCC,
796 gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
797 variables.
799 @c man end