OSDN Git Service

Commit for Asher Langton
[pf3gnuchains/gcc-fork.git] / gcc / fortran / invoke.texi
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.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 2004, 2005
9 Free Software Foundation, Inc.
10
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.
18  
19 (a) The FSF's Front-Cover Text is:
20
21      A GNU Manual
22
23 (b) The FSF's Back-Cover Text is:
24
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{}
41
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
60
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
66
67 @c man begin DESCRIPTION
68
69 The @command{gfortran} command supports all the options supported by the
70 @command{gcc} command.  Only options specific to gfortran are documented here.
71
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).
76
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.
86
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
92
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
105
106 @node Option Summary
107 @section Option Summary
108
109 @c man begin OPTIONS
110
111 Here is a summary of all the options specific to GNU Fortran, grouped
112 by type.  Explanations are in the following sections.
113
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 -fdefault-double-8  -fdefault-integer-8  -fdefault-real-8 @gol
123 -fcray-pointer }
124
125 @item Warning Options
126 @xref{Warning Options,,Options to Request or Suppress Warnings}.
127 @gccoptlist{
128 -fsyntax-only  -pedantic  -pedantic-errors @gol
129 -w  -Wall  -Waliasing  -Wconversion @gol
130 -Wimplicit-interface  -Wnonstd-intrinsics  -Wsurprising  -Wunderflow @gol
131 -Wunused-labels -Wline-truncation @gol
132 -Werror  -W}
133
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}}
138
139 @item Directory Options
140 @xref{Directory Options,,Options for Directory Search}.
141 @gccoptlist{
142 -I@var{dir}  -M@var{dir}}
143
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}
150 @end table
151
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
161
162 @node Fortran Dialect Options
163 @section Options Controlling Fortran Dialect
164 @cindex dialect options
165 @cindex language, dialect options
166 @cindex options, dialect
167
168 The following options control the dialect of Fortran
169 that the compiler accepts:
170
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.
186
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.
198
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.
203
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.
209
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.
215
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.
223
224 @cindex -fno-backslash option
225 @cindex options, -fno-backslash
226 @item -fno-backslash
227 @cindex backslash
228 @cindex escape characters
229 @item
230 Compile switch to change the interpretation of a backslash from
231 ``C''-style escape characters to a single backslash character.
232
233 @cindex -ffixed-line-length-@var{n} option
234 @cindex options, -ffixed-line-length-@var{n}
235 @item -ffixed-line-length-@var{n}
236 @cindex source file format
237 @cindex lines, length
238 @cindex length of source lines
239 @cindex fixed form
240 @cindex limits, lengths of source lines
241 Set column after which characters are ignored in typical fixed-form
242 lines in the source file, and through which spaces are assumed (as
243 if padded to that length) after the ends of short fixed-form lines.
244
245 @cindex card image
246 @cindex extended-source option
247 Popular values for @var{n} include 72 (the
248 standard and the default), 80 (card image), and 132 (corresponds
249 to ``extended-source'' options in some popular compilers).
250 @var{n} may be @samp{none}, meaning that the entire line is meaningful
251 and that continued character constants never have implicit spaces appended
252 to them to fill out the line.
253 @option{-ffixed-line-length-0} means the same thing as
254 @option{-ffixed-line-length-none}.
255
256 @cindex -fmax-identifier-length=@var{n} option
257 @cindex option -fmax-identifier-length=@var{n}
258 @item -fmax-identifier-length=@var{n}
259 Specify the maximum allowed identifier length. Typical values are
260 31 (Fortran 95) and 63 (Fortran 200x).
261
262 @cindex -fimplicit-none option
263 @cindex options, -fimplicit-none
264 @item -fimplicit-none
265 Specify that no implicit typing is allowed, unless overridden by explicit
266 @samp{IMPLICIT} statements.  This is the equivalent of adding
267 @samp{implicit none} to the start of every procedure.
268
269 @cindex -fcray-pointer option
270 @cindex options, -fcray-pointer
271 @item -fcray-pointer
272 Enables the Cray pointer extension, which provides a C-like pointer.
273
274 @cindex -std=@var{std} option
275 @cindex option, -std=@var{std}
276 @item -std=@var{std}
277 Conform to the specified standard.  Allowed values for @var{std} are
278 @samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
279
280 @end table
281
282 @node Warning Options
283 @section Options to Request or Suppress Warnings
284 @cindex options, warnings
285 @cindex warnings, suppressing
286 @cindex messages, warning
287 @cindex suppressing warnings
288
289 Warnings are diagnostic messages that report constructions which
290 are not inherently erroneous but which are risky or suggest there
291 might have been an error.
292
293 You can request many specific warnings with options beginning @option{-W},
294 for example @option{-Wimplicit} to request warnings on implicit
295 declarations.  Each of these specific warning options also has a
296 negative form beginning @option{-Wno-} to turn off warnings;
297 for example, @option{-Wno-implicit}.  This manual lists only one of the
298 two forms, whichever is not the default.
299
300 These options control the amount and kinds of warnings produced by GNU
301 Fortran:
302
303 @table @gcctabopt
304 @cindex syntax checking
305 @cindex -fsyntax-only option
306 @cindex options, -fsyntax-only
307 @item -fsyntax-only
308 Check the code for syntax errors, but don't do anything beyond that.
309
310 @cindex -pedantic option
311 @cindex options, -pedantic
312 @item -pedantic
313 Issue warnings for uses of extensions to FORTRAN 95.
314 @option{-pedantic} also applies to C-language constructs where they
315 occur in GNU Fortran source files, such as use of @samp{\e} in a
316 character constant within a directive like @samp{#include}.
317
318 Valid FORTRAN 95 programs should compile properly with or without
319 this option.
320 However, without this option, certain GNU extensions and traditional
321 Fortran features are supported as well.
322 With this option, many of them are rejected.
323
324 Some users try to use @option{-pedantic} to check programs for conformance.
325 They soon find that it does not do quite what they want---it finds some
326 nonstandard practices, but not all.
327 However, improvements to @command{gfortran} in this area are welcome.
328
329 This should be used in conjunction with -std=@var{std}.
330
331 @cindex -pedantic-errors option
332 @cindex options, -pedantic-errors
333 @item -pedantic-errors
334 Like @option{-pedantic}, except that errors are produced rather than
335 warnings.
336
337 @cindex -w option
338 @cindex options, -w
339 @item -w
340 Inhibit all warning messages.
341
342
343 @cindex -Wall option
344 @cindex options, -Wall
345 @item -Wall
346 @cindex all warnings
347 @cindex warnings, all
348 Enables commonly used warning options that which pertain to usage that
349 we recommend avoiding and that we believe is easy to avoid.
350 This currently includes @option{-Wunused-labels}, @option{-Waliasing},
351 @option{-Wsurprising}, @option{-Wnonstd-intrinsic} and
352 @option{-Wline-truncation}.
353
354
355 @cindex -Waliasing option
356 @cindex options, -Waliasing
357 @item -Waliasing
358 @cindex aliasing
359 Warn about possible aliasing of dummy arguments. Specifically, it warns
360 if the same actual argument is associated with a dummy argument with
361 @code{intent(in)} and a dummy argument with @code{intent(out)} in a call
362 with an explicit interface.
363
364 The following example will trigger the warning.
365 @smallexample
366   interface
367     subroutine bar(a,b)
368       integer, intent(in) :: a
369       integer, intent(out) :: b
370     end subroutine
371   end interface
372   integer :: a
373
374   call bar(a,a)
375 @end smallexample
376
377
378 @cindex -Wconversion option
379 @cindex options, -Wconversion
380 @item -Wconversion
381 @cindex conversion
382 Warn about implicit conversions between different types.
383
384
385 @cindex -Wimplicit-interface option
386 @cindex options, -Wimplicit-interface
387 @item -Wimplicit-interface
388 Warn about when procedure are called without an explicit interface.
389 Note this only checks that an explicit interface is present.  It does not
390 check that the declared interfaces are consistent across program units.
391
392
393 @cindex -Wnonstd-intrinsic option
394 @cindex options, -Wnonstd-intrinsic
395 @item -Wnonstd-intrinsic
396 Warn if the user tries to use an intrinsic that does not belong to the 
397 standard the user has chosen via the -std option.
398
399
400 @cindex -Wsurprising
401 @cindex options, -Wsurprising
402 @item -Wsurprising
403 @cindex Suspicious
404 Produce a warning when ``suspicious'' code constructs are encountered.
405 While technically legal these usually indicate that an error has been made.
406
407 This currently produces a warning under the following circumstances:
408
409 @itemize @bullet
410 @item
411 An INTEGER SELECT construct has a CASE that can never be matched as its
412 lower value is greater than its upper value.
413
414 @item
415 A LOGICAL SELECT construct has three CASE statements.
416 @end itemize
417
418 @cindex -Wunderflow
419 @cindex options, -Wunderflow
420 @item -Wunderflow
421 @cindex UNDERFLOW
422 Produce a warning when numerical constant expressions are
423 encountered, which yield an UNDERFLOW during compilation.
424
425
426 @cindex -Wunused-labels option
427 @cindex options, -Wunused-labels
428 @item -Wunused-labels
429 @cindex unused labels
430 @cindex labels, unused
431 Warn whenever a label is defined but never referenced.
432
433
434 @cindex -Werror
435 @cindex options, -Werror
436 @item -Werror
437 Turns all warnings into errors.
438
439
440 @cindex -W option
441 @cindex options, -W
442 @item -W
443 @cindex extra warnings
444 @cindex warnings, extra
445 Turns on ``extra warnings'' and, if optimization is specified
446 via @option{-O}, the @option{-Wuninitialized} option.
447 (This might change in future versions of @command{gfortran}
448 @end table
449
450 @xref{Warning Options,,Options to Request or Suppress Warnings,
451 gcc,Using the GNU Compiler Collection (GCC)}, for information on more
452 options offered by the GBE shared by @command{gfortran}, @command{gcc} and
453 other GNU compilers.
454
455 Some of these have no effect when compiling programs written in Fortran.
456
457 @node Debugging Options
458 @section Options for Debugging Your Program or GNU Fortran
459 @cindex options, debugging
460 @cindex debugging information options
461
462 GNU Fortran has various special options that are used for debugging
463 either your program or @command{gfortran}
464
465 @table @gcctabopt
466 @cindex -fdump-parse-tree option
467 @cindex option, -fdump-parse-tree
468 @item -fdump-parse-tree
469 Output the internal parse tree before starting code generation.  Only
470 really useful for debugging gfortran itself.
471 @end table
472
473 @table @gcctabopt
474 @cindex -ffpe-trap=@var{list} option
475 @cindex option, -ffpe-trap=@var{list}
476 @item -ffpe-trap=@var{list}
477 Specify a list of IEEE exceptions when a Floating Point Exception
478 (FPE) should be raised.  On most systems, this will result in a SIGFPE
479 signal being sent and the program being interrupted, producing a core
480 file useful for debugging.  @var{list} is a (possibly empty) comma-separated
481 list of the following IEEE exceptions: @samp{invalid} (invalid floating
482 point operation, such as @code{sqrt(-1.0)}), @samp{zero} (division by
483 zero), @samp{overflow} (overflow in a floating point operation),
484 @samp{underflow} (underflow in a floating point operation),
485 @samp{precision} (loss of precision during operation) and @samp{denormal}
486 (operation produced a denormal denormal value).
487 @end table
488
489 @xref{Debugging Options,,Options for Debugging Your Program or GCC,
490 gcc,Using the GNU Compiler Collection (GCC)}, for more information on
491 debugging options.
492
493 @node Directory Options
494 @section Options for Directory Search
495 @cindex directory, options
496 @cindex options, directory search
497 @cindex search path
498
499 @cindex INCLUDE directive
500 @cindex directive, INCLUDE
501 These options affect how @command{gfortran} searches
502 for files specified by the @code{INCLUDE} directive and where it searches
503 for previously compiled modules.
504
505 It also affects the search paths used by @command{cpp} when used to preprocess
506 Fortran source.
507
508 @table @gcctabopt
509 @cindex -Idir option
510 @cindex options, -Idir
511 @item -I@var{dir}
512 @cindex directory, search paths for inclusion
513 @cindex inclusion, directory search paths for
514 @cindex search paths, for included files
515 @cindex paths, search
516 @cindex module search path
517 These affect interpretation of the @code{INCLUDE} directive
518 (as well as of the @code{#include} directive of the @command{cpp}
519 preprocessor).
520
521 Also note that the general behavior of @option{-I} and
522 @code{INCLUDE} is pretty much the same as of @option{-I} with
523 @code{#include} in the @command{cpp} preprocessor, with regard to
524 looking for @file{header.gcc} files and other such things.
525
526 This path is also used to search for @samp{.mod} files when previously
527 compiled modules are required by a @code{USE} statement.
528
529 @xref{Directory Options,,Options for Directory Search,
530 gcc,Using the GNU Compiler Collection (GCC)}, for information on the
531 @option{-I} option.
532
533 @cindex -Mdir option
534 @cindex option, -Mdir
535 @item -M@var{dir}
536 @item -J@var{dir}
537 This option specifies where to put @samp{.mod} files for compiled modules.
538 It is also added to the list of directories to searched by an @code{USE}
539 statement.
540
541 The default is the current directory.
542
543 @option{-J} is an alias for @option{-M} to avoid conflicts with existing
544 GCC options.
545 @end table
546
547 @node Code Gen Options
548 @section Options for Code Generation Conventions
549 @cindex code generation, conventions
550 @cindex options, code generation
551 @cindex run-time, options
552
553 These machine-independent options control the interface conventions
554 used in code generation.
555
556 Most of them have both positive and negative forms; the negative form
557 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
558 one of the forms is listed---the one which is not the default.  You
559 can figure out the other form by either removing @option{no-} or adding
560 it.
561
562 @table @gcctabopt
563 @cindex @option{-fno-automatic} option
564 @cindex options, @option{-fno-automatic}
565 @item -fno-automatic
566 @cindex SAVE statement
567 @cindex statements, SAVE
568 Treat each program unit as if the @code{SAVE} statement was specified for
569 every local variable and array referenced in it. Does not affect common
570 blocks. (Some Fortran compilers provide this option under the name
571 @option{-static}.)
572
573 @cindex @option{-ff2c} option
574 @cindex options, @option{-ff2c}
575 @item -ff2c
576 @cindex calling convention
577 @cindex @command{f2c} calling convention
578 @cindex @command{g77} calling convention
579 @cindex libf2c calling convention
580 Generate code designed to be compatible with code generated
581 by @command{g77} and @command{f2c}.
582
583 The calling conventions used by @command{g77} (originally implemented
584 in @command{f2c}) require functions that return type
585 default @code{REAL} to actually return the C type @code{double}, and
586 functions that return type @code{COMPLEX} to return the values via an
587 extra argument in the calling sequence that points to where to
588 store the return value.  Under the default GNU calling conventions, such
589 functions simply return their results as they would in GNU
590 C -- default @code{REAL} functions return the C type @code{float}, and
591 @code{COMPLEX} functions return the GNU C type @code{complex}.
592 Additionally, this option implies the @option{-fsecond-underscore}
593 option, unless @option{-fno-second-underscore} is explicitly requested.
594
595 This does not affect the generation of code that interfaces with
596 the @command{libgfortran} library.
597
598 @emph{Caution:} It is not a good idea to mix Fortran code compiled
599 with @code{-ff2c} with code compiled with the default @code{-fno-f2c}
600 calling conventions as, calling @code{COMPLEX} or default @code{REAL}
601 functions between program parts which were compiled with different
602 calling conventions will break at execution time.
603
604 @emph{Caution:} This will break code which passes intrinsic functions
605 of type default @code{REAL} or @code{COMPLEX} as actual arguments, as
606 the library implementations use the @command{-fno-f2c} calling conventions.
607
608 @cindex @option{-fno-underscoring option}
609 @cindex options, @option{-fno-underscoring}
610 @item -fno-underscoring
611 @cindex underscore
612 @cindex symbol names, underscores
613 @cindex transforming symbol names
614 @cindex symbol names, transforming
615 Do not transform names of entities specified in the Fortran
616 source file by appending underscores to them.
617
618 With @option{-funderscoring} in effect, @command{gfortran} appends one
619 underscore to external names with no underscores.  This is done to ensure
620 compatibility with code produced by many UNIX Fortran compilers.
621
622 @emph{Caution}: The default behavior of @command{gfortran} is
623 incompatible with @command{f2c} and @command{g77}, please use the
624 @option{-ff2c} option if you want object files compiled with
625 @option{gfortran} to be compatible with object code created with these
626 tools.
627
628 Use of @option{-fno-underscoring} is not recommended unless you are
629 experimenting with issues such as integration of (GNU) Fortran into
630 existing system environments (vis-a-vis existing libraries, tools, and
631 so on).
632
633 For example, with @option{-funderscoring}, and assuming other defaults like
634 @option{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
635 external functions while @samp{my_var} and @samp{lvar} are local variables,
636 a statement like
637
638 @smallexample
639 I = J() + MAX_COUNT (MY_VAR, LVAR)
640 @end smallexample
641
642 @noindent
643 is implemented as something akin to:
644
645 @smallexample
646 i = j_() + max_count__(&my_var__, &lvar);
647 @end smallexample
648
649 With @option{-fno-underscoring}, the same statement is implemented as:
650
651 @smallexample
652 i = j() + max_count(&my_var, &lvar);
653 @end smallexample
654
655 Use of @option{-fno-underscoring} allows direct specification of
656 user-defined names while debugging and when interfacing @command{gfortran}
657 code with other languages.
658
659 Note that just because the names match does @emph{not} mean that the
660 interface implemented by @command{gfortran} for an external name matches the
661 interface implemented by some other language for that same name.
662 That is, getting code produced by @command{gfortran} to link to code produced
663 by some other compiler using this or any other method can be only a
664 small part of the overall solution---getting the code generated by
665 both compilers to agree on issues other than naming can require
666 significant effort, and, unlike naming disagreements, linkers normally
667 cannot detect disagreements in these other areas.
668
669 Also, note that with @option{-fno-underscoring}, the lack of appended
670 underscores introduces the very real possibility that a user-defined
671 external name will conflict with a name in a system library, which
672 could make finding unresolved-reference bugs quite difficult in some
673 cases---they might occur at program run time, and show up only as
674 buggy behavior at run time.
675
676 In future versions of @command{gfortran} we hope to improve naming and linking
677 issues so that debugging always involves using the names as they appear
678 in the source, even if the names as seen by the linker are mangled to
679 prevent accidental linking between procedures with incompatible
680 interfaces.
681
682 @cindex @option{-fsecond-underscore option}
683 @cindex options, @option{-fsecond-underscore}
684 @item -fsecond-underscore
685 @cindex underscore
686 @cindex symbol names, underscores
687 @cindex transforming symbol names
688 @cindex symbol names, transforming
689 @cindex @command{f2c} calling convention
690 @cindex @command{g77} calling convention
691 @cindex libf2c calling convention
692 By default, @command{gfortran} appends an underscore to external
693 names.  If this option is used @command{gfortran} appends two
694 underscores to names with underscores and one underscore to external names
695 with no underscores.  (@command{gfortran} also appends two underscores to
696 internal names with underscores to avoid naming collisions with external
697 names.
698
699 This option has no effect if @option{-fno-underscoring} is
700 in effect.  It is implied by the @option{-ff2c} option.
701
702 Otherwise, with this option, an external name such as @samp{MAX_COUNT}
703 is implemented as a reference to the link-time external symbol
704 @samp{max_count__}, instead of @samp{max_count_}.  This is required
705 for compatibility with @command{g77} and @command{f2c}, and is implied
706 by use of the @option{-ff2c} option.
707
708
709 @cindex -fbounds-check option
710 @cindex -ffortran-bounds-check option
711 @item -fbounds-check
712 @cindex bounds checking
713 @cindex range checking
714 @cindex array bounds checking
715 @cindex subscript checking
716 @cindex checking subscripts
717 Enable generation of run-time checks for array subscripts
718 and against the declared minimum and maximum values.  It also
719 checks array indices for assumed and deferred
720 shape arrays against the actual allocated bounds.
721
722 In the future this may also include other forms of checking, eg. checking
723 substring references.
724
725
726 @cindex -fmax-stack-var-size option
727 @item -fmax-stack-var-size=@var{n}
728 This option specifies the size in bytes of the largest array that will be put
729 on the stack.
730
731 This option currently only affects local arrays declared with constant
732 bounds, and may not apply to all character variables.
733 Future versions of @command{gfortran} may improve this behavior.
734
735 The default value for @var{n} is 32768.
736
737 @cindex -fpackderived
738 @item -fpackderived
739 @cindex Structure packing
740 This option tells gfortran to pack derived type members as closely as
741 possible.  Code compiled with this option is likely to be incompatible
742 with code compiled without this option, and may execute slower.
743
744 @cindex -frepack-arrays option
745 @item -frepack-arrays
746 @cindex Repacking arrays
747 In some circumstances @command{gfortran} may pass assumed shape array
748 sections via a descriptor describing a discontiguous area of memory.
749 This option adds code to the function prologue to repack the data into
750 a contiguous block at runtime.
751
752 This should result in faster accesses to the array.  However it can introduce
753 significant overhead to the function call, especially  when the passed data
754 is discontiguous.
755 @end table
756
757 @xref{Code Gen Options,,Options for Code Generation Conventions,
758 gcc,Using the GNU Compiler Collection (GCC)}, for information on more options
759 offered by the GBE
760 shared by @command{gfortran} @command{gcc} and other GNU compilers.
761
762
763 @c man end
764
765 @node Environment Variables
766 @section Environment Variables Affecting GNU Fortran
767 @cindex environment variables
768
769 @c man begin ENVIRONMENT
770
771 GNU Fortran 95 currently does not make use of any environment
772 variables to control its operation above and beyond those
773 that affect the operation of @command{gcc}.
774
775 @xref{Environment Variables,,Environment Variables Affecting GCC,
776 gcc,Using the GNU Compiler Collection (GCC)}, for information on environment
777 variables.
778
779 @c man end