Go to the first, previous, next, last section, table of contents.


Options That Control Optimization

Most Fortran users will want to use no optimization when developing and testing programs, and use `-O' or `-O2' when compiling programs for late-cycle testing and for production use. However, note that certain diagnostics--such as for uninitialized variables--depend on the flow analysis done by `-O', i.e. you must use `-O' or `-O2' to get such diagnostics.

The following flags have particular applicability when compiling Fortran programs:

-malign-double
(Intel x86 architecture only.) Noticeably improves performance of g77 programs making heavy use of REAL(KIND=2) (DOUBLE PRECISION) data on some systems. In particular, systems using Pentium, Pentium Pro, 586, and 686 implementations of the i386 architecture execute programs faster when REAL(KIND=2) (DOUBLE PRECISION) data are aligned on 64-bit boundaries in memory. This option can, at least, make benchmark results more consistent across various system configurations, versions of the program, and data sets. Note: The warning in the gcc documentation about this option does not apply, generally speaking, to Fortran code compiled by g77. Also note: `-malign-double' applies only to statically-allocated data. Double-precision data on the stack can still cause problems due to misalignment. See section Aligned Data. Also also note: The negative form of `-malign-double' is `-mno-align-double', not `-benign-double'.
-ffloat-store
Might help a Fortran program that depends on exact IEEE conformance on some machines, but might slow down a program that doesn't.
-fforce-mem
-fforce-addr
Might improve optimization of loops.
-fno-inline
Don't compile statement functions inline. Might reduce the size of a program unit--which might be at expense of some speed (though it should compile faster). Note that if you are not optimizing, no functions can be expanded inline.
-ffast-math
Might allow some programs designed to not be too dependent on IEEE behavior for floating-point to run faster, or die trying.
-fstrength-reduce
Might make some loops run faster.
-frerun-cse-after-loop
-fexpensive-optimizations
-fdelayed-branch
-fschedule-insns
-fschedule-insns2
-fcaller-saves
Might improve performance on some code.
-funroll-loops
Definitely improves performance on some code.
-funroll-all-loops
Improves performance on some code.

See section `Options That Control Optimization' in Using and Porting GNU CC, for more information on options to optimize the generated machine code.


Go to the first, previous, next, last section, table of contents.