HP Fortran Programmer Guide (766160-001, March 2014)
If the size of executable is critical to your application, you can use the +stripoption to remove
symbol table information from the production version of your program. If you compile and link on
separate command lines, you must use the +stripoption on both command lines. Instead of
recompiling with +strip, you can use the strip utility, which removes all debugging information,
including the symbol table.
If the size of your executable is not important, you may want to retain the symbol table in the
production version of your program. This table can be used by the debugger to provide minimal
debugging. If a program has not been compiled with -g and does not include a symbol table, it
is unusable by the debugger. Also, without the information provided by the symbol table, a
procedure traceback displays virtual addresses only.
The amount of code that the symbol table information that adds to an executable is considerably
less than the amount that compiling with -g adds. For descriptions of the -gand +strip options,
see the HP Fortran Programmer’s Reference. For information about the strip utility, refer to thestrip(1)
man page.
Handling runtime exceptions
Broadly defined, an exception is an error or fault condition that affects a program’s results.
Exceptions can range from the relatively begin in exact result condition that occurs in certain
floating-point operations to the more severe segmentation violation that occurs when a runaway
program attempts to access unallocated memory.
Exceptions that threaten the integrity of the operating system can cause HP-UX to raise an exception
signal (for example, SIGSEGV for a segmentation violation) so that the process can take appropriate
action to recover from the exception. Such exceptions may cause the program that took the exception
to abort, but not necessarily. By trapping an exception—that is, by catching the signal—a program
may handle the exception, if only by aborting when it occurs.
There are also a well-defined set of floating-point conditions that, although they pose no threat to
the operating system, can also cause an exception—for example, dividing a floating-point number
by zero. By default, traps for floating-point exceptions are disabled on HP9000 computers, but
they can be enabled by +fp_exceptionand +FPoptions. (You can also use the ON statement to
enable traps for floating-point exceptions.)
Programs that have been compiled with the +fp_exception option can trap the exceptions listed
in Table4-1. Any of the exceptions listed in the second column will cause the operating system to
generate the signal listed in the first column. Programs compiled with +FP can trap specific
floating-point exceptions (SIGFPE).
Table 25 Signals recognized by +fp_exception
ExceptionSignal
Bus error instructionSIGBUS
Floating-point exceptionsSIGFPE
Illegal instructionSIGILL
Segmentation violation or memory faultSIGSEGV
Bad argument to a kernel system callSIGSYS
When a program compiled with +fp_exception takes an exception, the following events occur:
• The program traps the exception.
• A procedure traceback is displayed on standard error. A procedure traceback lists routine
names and their offsets that are helpful in locating the code that triggered the exception.
• The program aborts.
Handling runtime exceptions 77