H-Series Application Migration Guide (H06.03+)

Reporting Compiler Optimization Problems
H-Series Application Migration Guide429855-006
C-2
Additional Information Needed for Compiler Errors
and Compiler Aborts
Additional Information Needed for Compiler Errors and Compiler
Aborts
To diagnose a compile-time failure, HP requires a preprocessed version of the file that
produced the failure. To obtain a preprocessed file, specify the following parameters on
the compiler run command:
After creating the preprocessed file, you should compile it to verify that the file was
created correctly and that the error can be reproduced.
Be sure to include the exact text of the error message in your report.
Additional Information Needed for Incorrect Results Error
For programs that generate incorrect results, you should attempt to isolate the error. It
is helpful if you can abstract a small case from the original application demonstrating
the incorrect behavior. Actions you can take to isolate the error include:
If the program contains debugging information, use a debugger (Native Inspect or
Visual Inspect) to step through the program. Verify that you do not reach the failure
state because the code is written to do so.
If the program does not contain debugging information, insert PRINTF statements
in the code to gather data points that might be helpful. Note, however, that changes
to the source code can result in code transformations that hide the error, so use
PRINTF statements with caution.
Make use of the compiler’s ability to toggle optimizations per routine. You can
create an optimize file that specifies which optimization level the compiler should
apply to a particular routine. You can apply a binary search algorithm to determine
the exact routine that is causing the problem. (Note, however, that more than one
routine may be causing the problem.) For details on creating an optimize file, see
Creating an Optimize File on page C-4
For example, suppose an application consists of functions A, B, and C, and the
application fails at optimization level 2. Create an optimize file that directs the
compiler to compile functions A and B at level 0. (Function C will continue to be
compiled at level 2.) If the failure no longer occurs, you can conclude that the
problem is related to A or B. If you then compile A at level 0 and remaining
functions at level 2, and the error still does not occur, A is the likely source of the
error.
If you are unable to isolate the problem, your problem report should include the source
code for the entire program, as well as instructions on how to build the program and
how to identify whether the program is running incorrectly.
Guardian Environment PC or OSS Environment
C/C++ compiler CPPONLY FILE filename
-E flag
pTAL compiler
SAVESOURCE filename -savesource filename