📄 g77.texi
字号:
@node Invoking G77@chapter GNU Fortran Command Options@cindex GNU Fortran command options@cindex command options@cindex options, GNU Fortran commandThe @code{g77} command supports all the options supported by the@code{gcc} command.@xref{Invoking GCC,,GNU CC Command Options,gcc,Using and Porting GNU CC},for informationon the non-Fortran-specific aspects of the @code{gcc} command (and,therefore, the @code{g77} command).@cindex options, negative forms@cindex negative forms of optionsAll @code{gcc} and @code{g77} optionsare accepted both by @code{g77} and by @code{gcc}(as well as any other drivers built at the same time,such as @code{g++}),since adding @code{g77} to the @code{gcc} distributionenables acceptance of @code{g77}-specific optionsby all of the relevant drivers.In some cases, options have positive and negative forms;the negative form of @samp{-ffoo} would be @samp{-fno-foo}.This manual documents only one of these two forms, whicheverone is not the default.@menu* Option Summary:: Brief list of all @code{g77} options, without explanations.* Overall Options:: Controlling the kind of output: an executable, object files, assembler files, or preprocessed source.* Shorthand Options:: Options that are shorthand for other options.* Fortran Dialect Options:: Controlling the variant of Fortran language compiled.* Warning Options:: How picky should the compiler be?* Debugging Options:: Symbol tables, measurements, and debugging dumps.* Optimize Options:: How much optimization?* Preprocessor Options:: Controlling header files and macro definitions. Also, getting dependency information for Make.* Directory Options:: Where to find header files and libraries. Where to find the compiler executable files.* Code Gen Options:: Specifying conventions for function calls, data layout and register usage.* Environment Variables:: Env vars that affect GNU Fortran.@end menu@node Option Summary@section Option SummaryHere is a summary of all the options specific to GNU Fortran, groupedby type. Explanations are in the following sections.@table @emph@item Overall Options@xref{Overall Options,,Options Controlling the Kind of Output}.@smallexample-fversion -fset-g77-defaults -fno-silent@end smallexample@item Shorthand Options@xref{Shorthand Options}.@smallexample-ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly@end smallexample@item Fortran Language Options@xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.@smallexample-ffree-form -fno-fixed-form -ff90-fvxt -fdollar-ok -fno-backslash-fno-ugly-args -fno-ugly-assign -fno-ugly-assumed-fugly-comma -fugly-complex -fugly-init -fugly-logint-fonetrip -ftypeless-boz-fintrin-case-initcap -fintrin-case-upper-fintrin-case-lower -fintrin-case-any-fmatch-case-initcap -fmatch-case-upper-fmatch-case-lower -fmatch-case-any-fsource-case-upper -fsource-case-lower -fsource-case-preserve-fsymbol-case-initcap -fsymbol-case-upper-fsymbol-case-lower -fsymbol-case-any-fcase-strict-upper -fcase-strict-lower-fcase-initcap -fcase-upper -fcase-lower -fcase-preserve-ff2c-intrinsics-delete -ff2c-intrinsics-hide-ff2c-intrinsics-disable -ff2c-intrinsics-enable-fbadu77-intrinsics-delete -fbadu77-intrinsics-hide-fbadu77-intrinsics-disable -fbadu77-intrinsics-enable-ff90-intrinsics-delete -ff90-intrinsics-hide-ff90-intrinsics-disable -ff90-intrinsics-enable-fgnu-intrinsics-delete -fgnu-intrinsics-hide-fgnu-intrinsics-disable -fgnu-intrinsics-enable-fmil-intrinsics-delete -fmil-intrinsics-hide-fmil-intrinsics-disable -fmil-intrinsics-enable-funix-intrinsics-delete -funix-intrinsics-hide-funix-intrinsics-disable -funix-intrinsics-enable-fvxt-intrinsics-delete -fvxt-intrinsics-hide-fvxt-intrinsics-disable -fvxt-intrinsics-enable-ffixed-line-length-@var{n} -ffixed-line-length-none@end smallexample@item Warning Options@xref{Warning Options,,Options to Request or Suppress Warnings}.@smallexample-fsyntax-only -pedantic -pedantic-errors -fpedantic-w -Wno-globals -Wimplicit -Wunused -Wuninitialized-Wall -Wsurprising-Werror -W@end smallexample@item Debugging Options@xref{Debugging Options,,Options for Debugging Your Program or GCC}.@smallexample-g@end smallexample@item Optimization Options@xref{Optimize Options,,Options that Control Optimization}.@smallexample-malign-double-ffloat-store -fforce-mem -fforce-addr -fno-inline-ffast-math -fstrength-reduce -frerun-cse-after-loop-fexpensive-optimizations -fdelayed-branch-fschedule-insns -fschedule-insn2 -fcaller-saves-funroll-loops -funroll-all-loops-fno-move-all-movables -fno-reduce-all-givs-fno-rerun-loop-opt@end smallexample@item Directory Options@xref{Directory Options,,Options for Directory Search}.@smallexample-I@var{dir} -I-@end smallexample@item Code Generation Options@xref{Code Gen Options,,Options for Code Generation Conventions}.@smallexample-fno-automatic -finit-local-zero -fno-f2c-ff2c-library -fno-underscoring -fno-ident-fpcc-struct-return -freg-struct-return-fshort-double -fno-common -fpack-struct-fzeros -fno-second-underscore-fdebug-kludge -femulate-complex-falias-check -fargument-alias-fargument-noalias -fno-argument-noalias-global-fno-globals -fflatten-arrays-fbounds-check -ffortran-bounds-check@end smallexample@end table@menu* Overall Options:: Controlling the kind of output: an executable, object files, assembler files, or preprocessed source.* Shorthand Options:: Options that are shorthand for other options.* Fortran Dialect Options:: Controlling the variant of Fortran language compiled.* Warning Options:: How picky should the compiler be?* Debugging Options:: Symbol tables, measurements, and debugging dumps.* Optimize Options:: How much optimization?* Preprocessor Options:: Controlling header files and macro definitions. Also, getting dependency information for Make.* Directory Options:: Where to find header files and libraries. Where to find the compiler executable files.* Code Gen Options:: Specifying conventions for function calls, data layout and register usage.@end menu@node Overall Options@section Options Controlling the Kind of Output@cindex overall options@cindex options, overallCompilation can involve as many as four stages: preprocessing, codegeneration (often what is really meant by the term ``compilation''),assembly, and linking, always in that order. The first threestages apply to an individual source file, and end by producing anobject file; linking combines all the object files (those newlycompiled, and those specified as input) into an executable file.@cindex file name suffix@cindex suffixes, file name@cindex file name extension@cindex extensions, file name@cindex file type@cindex types, fileFor any given input file, the file name suffix determines what kind ofprogram is contained in the file---that is, the language in which theprogram is written is generally indicated by the suffix.Suffixes specific to GNU Fortran are listed below.@xref{Overall Options,,gcc,Using and Porting GNU CC}, forinformation on suffixes recognized by GNU CC.@table @code@cindex .f filename suffix@cindex .for filename suffix@cindex .FOR filename suffix@item @var{file}.f@item @var{file}.for@item @var{file}.FORFortran source code that should not be preprocessed.Such source code cannot contain any preprocessor directives, suchas @code{#include}, @code{#define}, @code{#if}, and so on.You can force @samp{.f} files to be preprocessed by @code{cpp} by using@samp{-x f77-cpp-input}.@xref{LEX}.@cindex preprocessor@cindex C preprocessor@cindex cpp preprocessor@cindex Fortran preprocessor@cindex cpp program@cindex programs, cpp@cindex .F filename suffix@cindex .fpp filename suffix@cindex .FPP filename suffix@item @var{file}.F@item @var{file}.fpp@item @var{file}.FPPFortran source code that must be preprocessed (by the C preprocessor@code{cpp}, which is part of GNU CC).Note that preprocessing is not extended to the contents offiles included by the @code{INCLUDE} directive---the @code{#include}preprocessor directive must be used instead.@cindex Ratfor preprocessor@cindex programs, @code{ratfor}@cindex @samp{.r} filename suffix@cindex @code{ratfor}@item @var{file}.rRatfor source code, which must be preprocessed by the @code{ratfor}command, which is available separately (as it is not yet part of the GNUFortran distribution).One version in Fortran, adapted for use with @code{g77}, is at@uref{ftp://members.aol.com/n8tm/rat7.uue} (of uncertain copyrightstatus). Another, public domain version in C is at@uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}.@end tableUNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F}nomenclature.Users of other operating systems, especially those that cannotdistinguish upper-caseletters from lower-case letters in their file names, typically usethe @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature.@cindex #define@cindex #include@cindex #ifUse of the preprocessor @code{cpp} allows use of C-likeconstructs such as @code{#define} and @code{#include}, but canlead to unexpected, even mistaken, results due to Fortran's source fileformat.It is recommended that use of the C preprocessorbe limited to @code{#include} and, inconjunction with @code{#define}, only @code{#if} and related directives,thus avoiding in-line macro expansion entirely.This recommendation applies especiallywhen using the traditional fixed source form.With free source form,fewer unexpected transformations are likely to happen, but use ofconstructs such as Hollerith and character constants can neverthelesspresent problems, especially when these are continued across multiplesource lines.These problems result, primarily, from differences between the waysuch constants are interpreted by the C preprocessor and by a Fortrancompiler.Another example of a problem that results from using the C preprocessoris that a Fortran comment line that happens to contain anycharacters ``interesting'' to the C preprocessor,such as a backslash at the end of the line,is not recognized by the preprocessor as a comment line,so instead of being passed through ``raw'',the line is edited according to the rules for the preprocessor.For example, the backslash at the end of the line is removed,along with the subsequent newline, resulting in the nextline being effectively commented out---unfortunate if thatline is a non-comment line of important code!@emph{Note:} The @samp{-traditional} and @samp{-undef} flags are suppliedto @code{cpp} by default, to help avoid unpleasant surprises.@xref{Preprocessor Options,,Options Controlling the Preprocessor,gcc,Using and Porting GNU CC}.This means that ANSI C preprocessor features (such as the @samp{#}operator) aren't available, and only variables in the C reservednamespace (generally, names with a leading underscore) are liable tosubstitution by C predefines.Thus, if you want to do system-specifictests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}.Use the @samp{-v} option to see exactly how the preprocessor is invoked.@cindex /*Unfortunately, the @samp{-traditional} flag will not avoid an error fromanything that @code{cpp} sees as an unterminated C comment, such as:@smallexampleC Some Fortran compilers accept /* as startingC an inline comment.@end smallexample@xref{Trailing Comment}.The following options that affect overall processing are recognizedby the @code{g77} and @code{gcc} commands in a GNU Fortran installation:@table @code@cindex -fversion option@cindex options, -fversion@cindex printing version information@cindex version information, printing@cindex consistency checks@cindex internal consistency checks@cindex checks, of internal consistency@item -fversionEnsure that the @code{g77}-specific version of the compiler phase is reported,if run,and, starting in @code{egcs} version 1.1,that internal consistency checks in the @file{f771} program are run.This option is supplied automatically when @samp{-v} or @samp{--verbose}is specified as a command-line option for @code{g77} or @code{gcc}and when the resulting commands compile Fortran source files.@cindex -fset-g77-defaults option@cindex options, -fset-g77-defaults@it
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -