HP Fortran Programmer's Guide (March 2010)
Compiling and linking
Compiling with the f90 command
Chapter 2 63
The following subsections describe the options in both categories. For information about the
options that control levels of optimization, see the description of the +On option in the “Option
descriptions” on page 27. The +O[no]info option, which provides compile-time information
about the optimization process, is described in the same section.
NOTE You can insert (or remove) underscore characters in the names of any of the
optimization options to improve their readability. The compiler will recognize
the option name with or without underscores.
Reviewing general optimization options
The following options allow you to control how optimization affects code size, compilation
time, runtime performance, and other user-visible effects. The syntax for using these options
is:
+O[no]optimization
where optimization is a parameter that specifies the class of optimization
to apply to your program. The different parameters are described below.
The prefix no negates the effect of optimization.
Except for +Oall, +Ofast and +Ofaster the options do not override a specified level of
optimization, nor do they imply a particular level. (The +Oall option automatically invokes
the highest level of optimization. +Ofast invokes +O2 level of optimization in addition to
few other specific flags described later. Whereas, +Ofaster invokes +O3 level of
optimization). To use any of these options you must also include the +On option on the same
command line, where n specifies the level at which the type of optimization is effective. Thus,
if you wish to apply all optimizations available at level 3 except those that might significantly
increase code size, you would use the command line:
f90 +O3 +Osize my_prog.f90
If an option is mistakenly used at a level at which the corresponding optimization is not
performed, the compiler will issue a warning message.
The defaults specified in the following descriptions are in effect only at the specified
optimization levels, unless stated otherwise.
+O[no]aggressive
+Oaggressive enables optimizations that can result in significant
performance improvement but can also change a program’s behavior. This
option is only effective at optimization level 2 or higher.