GFORTRAN(1) GNU GFORTRAN(1) NNAAMMEE gfortran - GNU Fortran 95 compiler SSYYNNOOPPSSIISS gfortran [--cc│--SS│--EE] [--gg] [--ppgg] [--OO_l_e_v_e_l] [--WW_w_a_r_n...] [--ppeeddaannttiicc] [--II_d_i_r...] [--LL_d_i_r...] [--DD_m_a_c_r_o[=_d_e_f_n]...] [--UU_m_a_c_r_o] [--ff_o_p_t_i_o_n...] [--mm_m_a_c_h_i_n_e_-_o_p_t_i_o_n...] [--oo _o_u_t_f_i_l_e] _i_n_f_i_l_e... Only the most useful options are listed here; see below for the remain- der. DDEESSCCRRIIPPTTIIOONN The ggffoorrttrraann command supports all the options supported by the ggcccc com- mand. Only options specific to gfortran are documented here. All ggcccc and ggffoorrttrraann options are accepted both by ggffoorrttrraann and by ggcccc (as well as any other drivers built at the same time, such as gg++++), since adding ggffoorrttrraann to the ggcccc distribution enables acceptance of ggffoorrttrraann options by all of the relevant drivers. In some cases, options have positive and negative forms; the negative form of --ffffoooo would be --ffnnoo--ffoooo. This manual documents only one of these two forms, whichever one is not the default. OOPPTTIIOONNSS Here is a summary of all the options specific to GNU Fortran, grouped by type. Explanations are in the following sections. _F_o_r_t_r_a_n _L_a_n_g_u_a_g_e _O_p_t_i_o_n_s --ffffrreeee--ffoorrmm --ffnnoo--ffiixxeedd--ffoorrmm --ffddoollllaarr--ookk --ffiimmpplliicciitt--nnoonnee --ffmmaaxx--iiddeennttiiffiieerr--lleennggtthh --ssttdd==_s_t_d --ffdd--lliinneess--aass--ccooddee --ffdd--lliinneess--aass--ccoommmmeennttss --ffffiixxeedd--lliinnee--lleennggtthh--_n --ffffiixxeedd--lliinnee--lleennggtthh--nnoonnee --ffffrreeee--lliinnee--lleennggtthh--_n --ffffrreeee--lliinnee--lleennggtthh--nnoonnee --ffddeeffaauulltt--ddoouubbllee--88 --ffddeeffaauulltt--iinntteeggeerr--88 --ffddeeffaauulltt--rreeaall--88 --ffccrraayy--ppooiinntteerr --ffooppeennmmpp --ffrraannggee--cchheecckk Warning Options --ffssyynnttaaxx--oonnllyy --ppeeddaannttiicc --ppeeddaannttiicc--eerrrroorrss --ww --WWaallll --WWaalliiaassiinngg --WWaammppeerrssaanndd --WWccoonnvveerrssiioonn --WWiimmpplliicciitt--iinntteerrffaaccee --WWnnoonnssttdd--iinnttrriinnssiiccss --WWssuurrpprriissiinngg --WWuunnddeerrffllooww --WWuunnuusseedd--llaabbeellss --WWlliinnee--ttrruunnccaattiioonn --WW Debugging Options --ffdduummpp--ppaarrssee--ttrreeee --ffffppee--ttrraapp==list Directory Options --IIdir --MMdir Runtime Options --ffccoonnvveerrtt==conversion --ffrreeccoorrdd--mmaarrkkeerr==length Code Generation Options --ffnnoo--aauuttoommaattiicc --ffff22cc --ffnnoo--uunnddeerrssccoorriinngg --ffsseeccoonndd--uunnddeerrssccoorree --ffbboouunnddss--cchheecckk --ffmmaaxx--ssttaacckk--vvaarr--ssiizzee==n --ffppaacckkddeerriivveedd --ffrreeppaacckk--aarrrraayyss --ffsshhoorrtt--eennuummss OOppttiioonnss CCoonnttrroolllliinngg FFoorrttrraann DDiiaalleecctt The following options control the dialect of Fortran that the compiler accepts: --ffffrreeee--ffoorrmm --ffffiixxeedd--ffoorrmm Specify the layout used by the source file. The free form layout was introduced in Fortran 90. Fixed form was traditionally used in older Fortran programs. --ffdd--lliinneess--aass--ccooddee --ffdd--lliinneess--aass--ccoommmmeennttss Enables special treating for lines with dd or DD in fixed form sources. If the --ffdd--lliinneess--aass--ccooddee option is given they are treated as if the first column contained a blank. If the --ffdd--lliinneess--aass--ccoomm-- mmeennttss option is given, they are treated as comment lines. --ffddeeffaauulltt--ddoouubbllee--88 Set the "DOUBLE PRECISION" type to an 8 byte wide. --ffddeeffaauulltt--iinntteeggeerr--88 Set the default integer and logical types to an 8 byte wide type. Do nothing if this is already the default. --ffddeeffaauulltt--rreeaall--88 Set the default real type to an 8 byte wide type. Do nothing if this is already the default. --ffddoollllaarr--ookk Allow $$ as a valid character in a symbol name. --ffnnoo--bbaacckkssllaasshh Compile switch to change the interpretation of a backslash from "C"-style escape characters to a single backslash character. --ffffiixxeedd--lliinnee--lleennggtthh--n Set column after which characters are ignored in typical fixed-form lines in the source file, and through which spaces are assumed (as if padded to that length) after the ends of short fixed-form lines. Popular values for n include 72 (the standard and the default), 80 (card image), and 132 (corresponds to "extended-source" options in some popular compilers). n may be nnoonnee, meaning that the entire line is meaningful and that continued character constants never have implicit spaces appended to them to fill out the line. --ffffiixxeedd--lliinnee--lleennggtthh--00 means the same thing as --ffffiixxeedd--lliinnee--lleennggtthh--nnoonnee. --ffffrreeee--lliinnee--lleennggtthh--n Set column after which characters are ignored in typical free-form lines in the source file. For free-form, the default value is 132. n may be nnoonnee, meaning that the entire line is meaningful. --ffffrreeee--lliinnee--lleennggtthh--00 means the same thing as --ffffrreeee--lliinnee--lleennggtthh--nnoonnee. --ffmmaaxx--iiddeennttiiffiieerr--lleennggtthh==n Specify the maximum allowed identifier length. Typical values are 31 (Fortran 95) and 63 (Fortran 200x). --ffiimmpplliicciitt--nnoonnee Specify that no implicit typing is allowed, unless overridden by explicit IIMMPPLLIICCIITT statements. This is the equivalent of adding iimmpplliicciitt nnoonnee to the start of every procedure. --ffccrraayy--ppooiinntteerr Enables the Cray pointer extension, which provides a C-like pointer. --ffooppeennmmpp Enables handling of OpenMP "!$omp" directives in free form and "c$omp", *$omp and "!$omp" directives in fixed form, enables "!$" conditional compilation sentinels in free form and "c$", "*$" and "!$" sentinels in fixed form and when linking arranges for the OpenMP runtime library to be linked in. --ffrraannggee--cchheecckk Enable range checking on results of simplification of constant expressions during compilation. For example, by default, ggffoorrttrraann will give an overflow error at compile time when simplifying "a = EXP(1000)". With --ffnnoo--rraannggee--cchheecckk, no error will be given and the variable "a" will be assigned the value "+Infinity". --ssttdd==std Conform to the specified standard. Allowed values for std are ggnnuu, ff9955, ff22000033 and lleeggaaccyy. OOppttiioonnss ttoo RReeqquueesstt oorr SSuupppprreessss WWaarrnniinnggss Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there might have been an error. You can request many specific warnings with options beginning --WW, for example --WWiimmpplliicciitt to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning --WWnnoo-- to turn off warnings; for example, --WWnnoo--iimmpplliicciitt. This manual lists only one of the two forms, whichever is not the default. These options control the amount and kinds of warnings produced by GNU Fortran: --ffssyynnttaaxx--oonnllyy Check the code for syntax errors, but don’t do anything beyond that. --ppeeddaannttiicc Issue warnings for uses of extensions to FORTRAN 95. --ppeeddaannttiicc also applies to C-language constructs where they occur in GNU For- tran source files, such as use of \\ee in a character constant within a directive like ##iinncclluuddee. Valid FORTRAN 95 programs should compile properly with or without this option. However, without this option, certain GNU extensions and traditional Fortran features are supported as well. With this option, many of them are rejected. Some users try to use --ppeeddaannttiicc to check programs for conformance. They soon find that it does not do quite what they want---it finds some nonstandard practices, but not all. However, improvements to ggffoorrttrraann in this area are welcome. This should be used in conjunction with -std=std. --ppeeddaannttiicc--eerrrroorrss Like --ppeeddaannttiicc, except that errors are produced rather than warn- ings. --ww Inhibit all warning messages. --WWaallll Enables commonly used warning options pertaining to usage that we recommend avoiding and that we believe are easy to avoid. This cur- rently includes --WWuunnuusseedd--llaabbeellss, --WWaalliiaassiinngg, --WWaammppeerrssaanndd, --WWssuurr-- pprriissiinngg, --WWnnoonnssttdd--iinnttrriinnssiicc, and --WWlliinnee--ttrruunnccaattiioonn. --WWaalliiaassiinngg Warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argu- ment with "intent(in)" and a dummy argument with "intent(out)" in a call with an explicit interface. The following example will trigger the warning. interface subroutine bar(a,b) integer, intent(in) :: a integer, intent(out) :: b end subroutine end interface integer :: a call bar(a,a) --WWaammppeerrssaanndd Warn about missing ampersand in continued character literals. The warning is given with --WWaammppeerrssaanndd, --ppeeddaannttiicc, and --ssttdd==ff9955. Note: With no ampersand given in a continued character literal, gfortran assumes continuation at the first non-comment, non-whitespace char- acter. --WWccoonnvveerrssiioonn Warn about implicit conversions between different types. --WWiimmpplliicciitt--iinntteerrffaaccee Warn about when procedure are called without an explicit interface. Note this only checks that an explicit interface is present. It does not check that the declared interfaces are consistent across program units. --WWnnoonnssttdd--iinnttrriinnssiicc Warn if the user tries to use an intrinsic that does not belong to the standard the user has chosen via the -std option. --WWssuurrpprriissiinngg Produce a warning when "suspicious" code constructs are encoun- tered. While technically legal these usually indicate that an error has been made. This currently produces a warning under the following circum- stances: * An INTEGER SELECT construct has a CASE that can never be matched as its lower value is greater than its upper value. * A LOGICAL SELECT construct has three CASE statements. --WWuunnddeerrffllooww Produce a warning when numerical constant expressions are encoun- tered, which yield an UNDERFLOW during compilation. --WWuunnuusseedd--llaabbeellss Warn whenever a label is defined but never referenced. --WWeerrrroorr Turns all warnings into errors. --WW Turns on "extra warnings" and, if optimization is specified via --OO, the --WWuunniinniittiiaalliizzeedd option. (This might change in future versions of ggffoorrttrraann Some of these have no effect when compiling programs written in For- tran. OOppttiioonnss ffoorr DDeebbuuggggiinngg YYoouurr PPrrooggrraamm oorr GGNNUU FFoorrttrraann GNU Fortran has various special options that are used for debugging either your program or ggffoorrttrraann --ffdduummpp--ppaarrssee--ttrreeee Output the internal parse tree before starting code generation. Only really useful for debugging gfortran itself. --ffffppee--ttrraapp==list Specify a list of IEEE exceptions when a Floating Point Exception (FPE) should be raised. On most systems, this will result in a SIGFPE signal being sent and the program being interrupted, produc- ing a core file useful for debugging. list is a (possibly empty) comma-separated list of the following IEEE exceptions: iinnvvaalliidd (invalid floating point operation, such as "sqrt(-1.0)"), zzeerroo (division by zero), oovveerrffllooww (overflow in a floating point opera- tion), uunnddeerrffllooww (underflow in a floating point operation), pprreeccii-- ssiioonn (loss of precision during operation) and ddeennoorrmmaall (operation produced a denormal denormal value). OOppttiioonnss ffoorr DDiirreeccttoorryy SSeeaarrcchh These options affect how ggffoorrttrraann searches for files specified by the "INCLUDE" directive and where it searches for previously compiled mod- ules. It also affects the search paths used by ccpppp when used to preprocess Fortran source. --IIdir These affect interpretation of the "INCLUDE" directive (as well as of the "#include" directive of the ccpppp preprocessor). Also note that the general behavior of --II and "INCLUDE" is pretty much the same as of --II with "#include" in the ccpppp preprocessor, with regard to looking for header.gcc files and other such things. This path is also used to search for ..mmoodd files when previously compiled modules are required by a "USE" statement. --MMdir --JJdir This option specifies where to put ..mmoodd files for compiled modules. It is also added to the list of directories to searched by an "USE" statement. The default is the current directory. --JJ is an alias for --MM to avoid conflicts with existing GCC options. IInnfflluueenncciinngg rruunnttiimmee bbeehhaavviioorr These options affect the runtime behavior of ggffoorrttrraann. --ffccoonnvveerrtt==conversion Specify the representation of data for unformatted files. Valid values for conversion are: nnaattiivvee, the default; sswwaapp, swap between big- and little-endian; bbiigg--eennddiiaann, use big-endian representation for unformatted files; lliittttllee--eennddiiaann, use little-endian representa- tion for unformatted files. This option has an effect only when used in the main program. The "CONVERT" specifier and the GFORTRANCONVERTUNIT environment vari- able override the default specified by -fconvert. --ffrreeccoorrdd--mmaarrkkeerr==length Specify the length of record markers for unformatted files. Valid values for length are 4 and 8. Default is whatever "offt" is specified to be on that particular system. Note that specifying length as 4 limits the record length of unformatted files to 2 GB. This option does not extend the maximum possible record length on systems where "offt" is a fourbyte quantity. OOppttiioonnss ffoorr CCooddee GGeenneerraattiioonn CCoonnvveennttiioonnss These machine-independent options control the interface conventions used in code generation. Most of them have both positive and negative forms; the negative form of --ffffoooo would be --ffnnoo--ffoooo. In the table below, only one of the forms is listed---the one which is not the default. You can figure out the other form by either removing nnoo-- or adding it. --ffnnoo--aauuttoommaattiicc Treat each program unit as if the "SAVE" statement was specified for every local variable and array referenced in it. Does not affect common blocks. (Some Fortran compilers provide this option under the name --ssttaattiicc.) --f2c Generate code designed to be compatible with code generated by gg7777 and ff22cc. The calling conventions used by gg7777 (originally implemented in ff22cc) require functions that return type default "REAL" to actually return the C type "double", and functions that return type "COM- PLEX" to return the values via an extra argument in the calling sequence that points to where to store the return value. Under the default GNU calling conventions, such functions simply return their results as they would in GNU C -- default "REAL" functions return the C type "float", and "COMPLEX" functions return the GNU C type "complex". Additionally, this option implies the --ffsseeccoonndd--uunnddeerr-- ssccoorree option, unless --ffnnoo--sseeccoonndd--uunnddeerrssccoorree is explicitly requested. This does not affect the generation of code that interfaces with the lliibbggffoorrttrraann library. Caution: It is not a good idea to mix Fortran code compiled with "-ff2c" with code compiled with the default "-fno-f2c" calling con- ventions as, calling "COMPLEX" or default "REAL" functions between program parts which were compiled with different calling conven- tions will break at execution time. Caution: This will break code which passes intrinsic functions of type default "REAL" or "COMPLEX" as actual arguments, as the library implementations use the --ffnnoo--ff22cc calling conventions. --ffnnoo--uunnddeerrssccoorriinngg Do not transform names of entities specified in the Fortran source file by appending underscores to them. With --ffuunnddeerrssccoorriinngg in effect, ggffoorrttrraann appends one underscore to external names with no underscores. This is done to ensure compat- ibility with code produced by many UNIX Fortran compilers. Caution: The default behavior of ggffoorrttrraann is incompatible with ff22cc and gg7777, please use the --ffff22cc option if you want object files compiled with ggffoorrttrraann to be compatible with object code created with these tools. Use of --ffnnoo--uunnddeerrssccoorriinngg is not recommended unless you are experi- menting with issues such as integration of (GNU) Fortran into existing system environments (vis-a-vis existing libraries, tools, and so on). For example, with --ffuunnddeerrssccoorriinngg, and assuming other defaults like --ffccaassee--lloowweerr and that jj(()) and mmaaxxccoouunntt(()) are external functions while mmyyvvaarr and llvvaarr are local variables, a statement like I = J() + MAXCOUNT (MYVAR, LVAR) is implemented as something akin to: i = j() + maxcount(&myvar, &lvar); With --ffnnoo--uunnddeerrssccoorriinngg, the same statement is implemented as: i = j() + maxcount(&myvar, &lvar); Use of --ffnnoo--uunnddeerrssccoorriinngg allows direct specification of user- defined names while debugging and when interfacing ggffoorrttrraann code with other languages. Note that just because the names match does not mean that the interface implemented by ggffoorrttrraann for an external name matches the interface implemented by some other language for that same name. That is, getting code produced by ggffoorrttrraann to link to code produced by some other compiler using this or any other method can be only a small part of the overall solution---getting the code generated by both compilers to agree on issues other than naming can require significant effort, and, unlike naming disagreements, linkers nor- mally cannot detect disagreements in these other areas. Also, note that with --ffnnoo--uunnddeerrssccoorriinngg, the lack of appended under- scores introduces the very real possibility that a user-defined external name will conflict with a name in a system library, which could make finding unresolved-reference bugs quite difficult in some cases---they might occur at program run time, and show up only as buggy behavior at run time. In future versions of ggffoorrttrraann we hope to improve naming and link- ing issues so that debugging always involves using the names as they appear in the source, even if the names as seen by the linker are mangled to prevent accidental linking between procedures with incompatible interfaces. --ffsseeccoonndd--uunnddeerrssccoorree By default, ggffoorrttrraann appends an underscore to external names. If this option is used ggffoorrttrraann appends two underscores to names with underscores and one underscore to external names with no under- scores. (ggffoorrttrraann also appends two underscores to internal names with underscores to avoid naming collisions with external names. This option has no effect if --ffnnoo--uunnddeerrssccoorriinngg is in effect. It is implied by the --ffff22cc option. Otherwise, with this option, an external name such as MMAAXXCCOOUUNNTT is implemented as a reference to the link-time external symbol mmaaxxccoouunntt, instead of mmaaxxccoouunntt. This is required for compati- bility with gg7777 and ff22cc, and is implied by use of the --ffff22cc option. --ffbboouunnddss--cchheecckk Enable generation of run-time checks for array subscripts and against the declared minimum and maximum values. It also checks array indices for assumed and deferred shape arrays against the actual allocated bounds. In the future this may also include other forms of checking, eg. checking substring references. --ffmmaaxx--ssttaacckk--vvaarr--ssiizzee==n This option specifies the size in bytes of the largest array that will be put on the stack. This option currently only affects local arrays declared with con- stant bounds, and may not apply to all character variables. Future versions of ggffoorrttrraann may improve this behavior. The default value for n is 32768. --ffppaacckkddeerriivveedd This option tells gfortran to pack derived type members as closely as possible. Code compiled with this option is likely to be incom- patible with code compiled without this option, and may execute slower. --ffrreeppaacckk--aarrrraayyss In some circumstances ggffoorrttrraann may pass assumed shape array sec- tions via a descriptor describing a discontiguous area of memory. This option adds code to the function prologue to repack the data into a contiguous block at runtime. This should result in faster accesses to the array. However it can introduce significant overhead to the function call, especially when the passed data is discontiguous. --ffsshhoorrtt--eennuummss This option is provided for interoperability with C code that was compiled with the --ffsshhoorrtt--eennuummss option. It will make ggffoorrttrraann choose the smallest "INTEGER" kind a given enumerator set will fit in, and give all its enumerators this kind. EENNVVIIRROONNMMEENNTT GNU Fortran 95 currently does not make use of any environment variables to control its operation above and beyond those that affect the opera- tion of ggcccc. BBUUGGSS For instructions on reporting bugs, see . SSEEEE AALLSSOO gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) and the Info entries for gcc, cpp, gfor- tran, as, ld, binutils and gdb. AAUUTTHHOORR See the Info entry for ggffoorrttrraann for contributors to GCC and GFORTRAN. CCOOPPYYRRIIGGHHTT Copyright (c) 2004, 2005, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being "GNU General Public License" and "Funding Free Software", the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the gfdl(7) man page. (a) The FSF’s Front-Cover Text is: A GNU Manual (b) The FSF’s Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. gcc-4.1.2 2007-09-25 GFORTRAN(1)