HP Compilers for HP Integrity Servers (September 2011)

in incorrect pointer accesses. Use the +Ocross_region_addressing option to
prevent this problem when an application cannot be rewritten to avoid such pointer
arithmetic.
The option +Oinitcheck will direct the compiler to detect and initialize all
uninitialized variables. Application code that contains uninitialized variables can
show unexpected behavior after optimization. Without this option, the compiler
attempts to detect and warn about uninitialized variables that are definitely
uninitialized along all paths. If a variable is uninitialized along only some paths to
its use, by default these will not be detected and can result in errors.
Similarly, the option +Oparminit causes the compiler to initialize to zero any
unspecified function parameters at call sites. Without using this option, these
unspecified parameters can contain NaT tokens from previous computations that
will result in incorrect behavior if they are consumed (see “Control speculation
(page 7)).
According to the C and C++ language standards, signed integer arithmetic overflow
in user code results in undefined behavior. The compiler makes assumptions that
such overflow does not occur during some optimizations. For example, the compiler
will remove sign extension operations within loop bodies assuming that integer
accumulations within the loop do not overflow. A program that relies on certain
behavior for overflowing arithmetic operations may behave differently after
optimization. The user can suppress assumptions made by some compiler
optimizations regarding the lack of overflow with the
+Ointeger_overflow=conservative option.
When compiling an application that relies on specific floating-point rounding behavior,
+Ofltacc=strict is appropriate. By default, the only value-changing optimization
the compiler performs is the synthesis of contractions. The resulting value is generally
more accurate because it has not been subject to an intermediate rounding. However,
some floating-point applications rely on the intermediate rounding for correct results.
A developer can narrow down the scope of a problem in optimized code by linking
together subsets of the application’s object files compiled at the failing optimization level
and at a lower, working optimization level. A binary search on the object files with this
method can quickly isolate the object file causing the execution failure. If the object file
contains more than one C or C++ routine, another binary search on the routines within
the source file using #pragma OPT_LEVEL n can usually identify the problematic
routine. The OPT_LEVEL pragma should always be used at global scope; it reduces the
optimization level to the value of the argument and that optimization level remains in
effect for the rest of the file or until set again by another pragma. The +O0=name option
can also be used to turn off optimization for selected functions. For Fortran applications,
the fsplit tool will split a single source file into multiple single-routine files.
32 HP compilers for HP Integrity servers