⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invoke.texi

📁 理解和实践操作系统的一本好书
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
@section Influencing runtime behavior@cindex options, runtimeThese options affect the runtime behavior of programs compiled with GNU Fortran.@table @gcctabopt@item -fconvert=@var{conversion}@opindex @code{fconvert=}@var{conversion}Specify the representation of data for unformatted files.  Validvalues for conversion are: @samp{native}, the default; @samp{swap},swap between big- and little-endian; @samp{big-endian}, use big-endianrepresentation for unformatted files; @samp{little-endian}, use little-endianrepresentation for unformatted files.@emph{This option has an effect only when used in the main program.The @code{CONVERT} specifier and the GFORTRAN_CONVERT_UNIT environmentvariable override the default specified by @option{-fconvert}.}@item -frecord-marker=@var{length}@opindex @code{frecord-marker=}@var{length}Specify the length of record markers for unformatted files.Valid values for @var{length} are 4 and 8.  Default is 4.@emph{This is different from previous versions of @command{gfortran}},which specified a default record marker length of 8 on mostsystems.  If you want to read or write files compatiblewith earlier versions of @command{gfortran}, use @option{-frecord-marker=8}.@item -fmax-subrecord-length=@var{length}@opindex @code{fmax-subrecord-length=}@var{length}Specify the maximum length for a subrecord.  The maximum permittedvalue for length is 2147483639, which is also the default.  Onlyreally useful for use by the gfortran testsuite.@item -fsign-zero@opindex @code{fsign-zero}When writing zero values, show the negative sign if the sign bit is set.@code{fno-sign-zero} does not print the negative sign of zero values forcompatibility with F77.  Default behavior is to show the negative sign.@end table@node Code Gen Options@section Options for code generation conventions@cindex code generation, conventions@cindex options, code generation@cindex options, run-timeThese machine-independent options control the interface conventionsused in code generation.Most of them have both positive and negative forms; the negative formof @option{-ffoo} would be @option{-fno-foo}.  In the table below, onlyone of the forms is listed---the one which is not the default.  Youcan figure out the other form by either removing @option{no-} or addingit.@table @gcctabopt@item -fno-automatic@opindex @code{fno-automatic}@cindex @code{SAVE} statement@cindex statement, @code{SAVE}Treat each program unit (except those marked as RECURSIVE) as if the@code{SAVE} statement were specified for every local variable and arrayreferenced in it. Does not affect common blocks. (Some Fortran compilersprovide this option under the name @option{-static} or @option{-save}.)The default, which is @option{-fautomatic}, uses the stack for localvariables smaller than the value given by @option{-fmax-stack-var-size}.Use the option @option{-frecursive} to use no static memory. @item -ff2c@opindex ff2c@cindex calling convention@cindex @command{f2c} calling convention@cindex @command{g77} calling convention@cindex libf2c calling conventionGenerate code designed to be compatible with code generatedby @command{g77} and @command{f2c}.The calling conventions used by @command{g77} (originally implementedin @command{f2c}) require functions that return typedefault @code{REAL} to actually return the C type @code{double}, andfunctions that return type @code{COMPLEX} to return the values via anextra argument in the calling sequence that points to where tostore the return value.  Under the default GNU calling conventions, suchfunctions simply return their results as they would in GNUC---default @code{REAL} functions return the C type @code{float}, and@code{COMPLEX} functions return the GNU C type @code{complex}.Additionally, this option implies the @option{-fsecond-underscore}option, unless @option{-fno-second-underscore} is explicitly requested.This does not affect the generation of code that interfaces withthe @command{libgfortran} library.@emph{Caution:} It is not a good idea to mix Fortran code compiled with@option{-ff2c} with code compiled with the default @option{-fno-f2c}calling conventions as, calling @code{COMPLEX} or default @code{REAL}functions between program parts which were compiled with differentcalling conventions will break at execution time.@emph{Caution:} This will break code which passes intrinsic functionsof type default @code{REAL} or @code{COMPLEX} as actual arguments, asthe library implementations use the @option{-fno-f2c} calling conventions.@item -fno-underscoring@opindex @code{fno-underscoring}@cindex underscore@cindex symbol names, underscores@cindex transforming symbol names@cindex symbol names, transformingDo not transform names of entities specified in the Fortransource file by appending underscores to them.With @option{-funderscoring} in effect, GNU Fortran appends oneunderscore to external names with no underscores.  This is done to ensurecompatibility with code produced by many UNIX Fortran compilers.@emph{Caution}: The default behavior of GNU Fortran isincompatible with @command{f2c} and @command{g77}, please use the@option{-ff2c} option if you want object files compiled withGNU Fortran to be compatible with object code created with thesetools.Use of @option{-fno-underscoring} is not recommended unless you areexperimenting with issues such as integration of GNU Fortran intoexisting system environments (vis-@`{a}-vis existing libraries, tools,and so on).For example, with @option{-funderscoring}, and assuming other defaults like@option{-fcase-lower} and that @code{j()} and @code{max_count()} areexternal functions while @code{my_var} and @code{lvar} are local variables,a statement like@smallexampleI = J() + MAX_COUNT (MY_VAR, LVAR)@end smallexample@noindentis implemented as something akin to:@smallexamplei = j_() + max_count__(&my_var__, &lvar);@end smallexampleWith @option{-fno-underscoring}, the same statement is implemented as:@smallexamplei = j() + max_count(&my_var, &lvar);@end smallexampleUse of @option{-fno-underscoring} allows direct specification ofuser-defined names while debugging and when interfacing GNU Fortrancode with other languages.Note that just because the names match does @emph{not} mean that theinterface implemented by GNU Fortran for an external name matches theinterface implemented by some other language for that same name.That is, getting code produced by GNU Fortran to link to code producedby some other compiler using this or any other method can be only asmall part of the overall solution---getting the code generated byboth compilers to agree on issues other than naming can requiresignificant effort, and, unlike naming disagreements, linkers normallycannot detect disagreements in these other areas.Also, note that with @option{-fno-underscoring}, the lack of appendedunderscores introduces the very real possibility that a user-definedexternal name will conflict with a name in a system library, whichcould make finding unresolved-reference bugs quite difficult in somecases---they might occur at program run time, and show up only asbuggy behavior at run time.In future versions of GNU Fortran we hope to improve naming and linkingissues so that debugging always involves using the names as they appearin the source, even if the names as seen by the linker are mangled toprevent accidental linking between procedures with incompatibleinterfaces.@item -fsecond-underscore@opindex @code{fsecond-underscore}@cindex underscore@cindex symbol names, underscores@cindex transforming symbol names@cindex symbol names, transforming@cindex @command{f2c} calling convention@cindex @command{g77} calling convention@cindex libf2c calling conventionBy default, GNU Fortran appends an underscore to externalnames.  If this option is used GNU Fortran appends twounderscores to names with underscores and one underscore to external nameswith no underscores.  GNU Fortran also appends two underscores tointernal names with underscores to avoid naming collisions with externalnames.This option has no effect if @option{-fno-underscoring} isin effect.  It is implied by the @option{-ff2c} option.Otherwise, with this option, an external name such as @code{MAX_COUNT}is implemented as a reference to the link-time external symbol@code{max_count__}, instead of @code{max_count_}.  This is requiredfor compatibility with @command{g77} and @command{f2c}, and is impliedby use of the @option{-ff2c} option.@item -fbounds-check@opindex @code{fbounds-check}@cindex array, bounds checking@cindex bounds checking@cindex range checking@cindex subscript checking@cindex checking subscriptsEnable generation of run-time checks for array subscriptsand against the declared minimum and maximum values.  It alsochecks array indices for assumed and deferredshape arrays against the actual allocated bounds.Some checks require that @option{-fbounds-check} is set forthe compilation of the main program.In the future this may also include other forms of checking, e.g., checkingsubstring references.@item -fmax-stack-var-size=@var{n}@opindex @code{fmax-stack-var-size}This option specifies the size in bytes of the largest array that will be puton the stack; if the size is exceeded static memory is used (except inprocedures marked as RECURSIVE). Use the option @option{-frecursive} toallow for recursive procedures which do not have a RECURSIVE attribute orfor parallel programs. Use @option{-fno-automatic} to never use the stack.This option currently only affects local arrays declared with constantbounds, and may not apply to all character variables.Future versions of GNU Fortran may improve this behavior.The default value for @var{n} is 32768.@item -fpack-derived@opindex @code{fpack-derived}@cindex structure packingThis option tells GNU Fortran to pack derived type members as closely aspossible.  Code compiled with this option is likely to be incompatiblewith code compiled without this option, and may execute slower.@item -frepack-arrays@opindex @code{frepack-arrays}@cindex repacking arraysIn some circumstances GNU Fortran may pass assumed shape arraysections via a descriptor describing a noncontiguous area of memory.This option adds code to the function prologue to repack the data intoa contiguous block at runtime.This should result in faster accesses to the array.  However it can introducesignificant overhead to the function call, especially  when the passed datais noncontiguous.@item -fshort-enums@opindex @code{fshort-enums}This option is provided for interoperability with C code that wascompiled with the @option{-fshort-enums} option.  It will makeGNU Fortran choose the smallest @code{INTEGER} kind a givenenumerator set will fit in, and give all its enumerators this kind.@item -fexternal-blas@opindex @code{fexternal-blas}This option will make @command{gfortran} generate calls to BLAS functionsfor some matrix operations like @code{MATMUL}, instead of using our ownalgorithms, if the size of the matrices involved is larger than a givenlimit (see @option{-fblas-matmul-limit}).  This may be profitable if anoptimized vendor BLAS library is available.  The BLAS library will haveto be specified at link time.@item -fblas-matmul-limit=@var{n}@opindex @code{fblas-matmul-limit}Only significant when @option{-fexternal-blas} is in effect.Matrix multiplication of matrices with size larger than (or equal to) @var{n}will be performed by calls to BLAS functions, while others will behandled by @command{gfortran} internal algorithms. If the matricesinvolved are not square, the size comparison is performed using thegeometric mean of the dimensions of the argument and result matrices.The default value for @var{n} is 30.@item -frecursive@opindex @code{frecursive}Allow indirect recursion by forcing all local arrays to be allocatedon the stack. This flag cannot be used together with@option{-fmax-stack-var-size=} or @option{-fno-automatic}.@item -finit-local-zero@item -finit-integer=@var{n}@item -finit-real=@var{<zero|inf|-inf|nan>} @item -finit-logical=@var{<true|false>}@item -finit-character=@var{n}@opindex @code{finit-local-zero}@opindex @code{finit-integer}@opindex @code{finit-real}@opindex @code{finit-logical}@opindex @code{finit-character}The @option{-finit-local-zero} option instructs the compiler toinitialize local @code{INTEGER}, @code{REAL}, and @code{COMPLEX}variables to zero, @code{LOGICAL} variables to false, and@code{CHARACTER} variables to a string of null bytes.  Finer-grainedinitialization options are provided by the@option{-finit-integer=@var{n}},@option{-finit-real=@var{<zero|inf|-inf|nan>}} (which also initializesthe real and imaginary parts of local @code{COMPLEX} variables),@option{-finit-logical=@var{<true|false>}}, and@option{-finit-character=@var{n}} (where @var{n} is an ASCII charactervalue) options.  These options do not initialize components of derivedtype variables, nor do they initialize variables that appear in an@code{EQUIVALENCE} statement.  (This limitation may be removed infuture releases).Note that the @option{-finit-real=nan} option initializes @code{REAL}and @code{COMPLEX} variables with a quiet NaN.@end table@xref{Code Gen Options,,Options for Code Generation Conventions,gcc,Using the GNU Compiler Collection (GCC)}, for information on more optionsoffered by the GBEshared by @command{gfortran}, @command{gcc}, and other GNU compilers.@c man end@node Environment Variables@section Environment variables affecting @command{gfortran}@cindex environment variable@c man begin ENVIRONMENTThe @command{gfortran} compiler currently does not make use of any environmentvariables to control its operation above and beyond thosethat affect the operation of @command{gcc}.@xref{Environment Variables,,Environment Variables Affecting GCC,gcc,Using the GNU Compiler Collection (GCC)}, for information on environmentvariables.@xref{Runtime}, for environment variables that affect therun-time behavior of programs compiled with GNU Fortran.@c man end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -