HP Fortran Programmer's Guide (B3908-90031; September 2011)

Debugging
Handling runtime exceptions
Chapter 4124
The program aborts.
The following sections discuss each of exceptions listed in Table 4-1. For more information about signals,
refer to the signal(2) and signal(5) man pages.
NOTE Standard Fortran 90 provides the IOSTAT= and ERR= specifiers for handling I/O runtime
errors. For information about these specifiers, refer to the descriptions of the I/O statements
(for example, OPEN and READ) in the HP Fortran Programmers Reference. For a
descriptive list of the error messages that can be returned by IOSTAT=, refer to the
HP Fortran Programmers Reference.
Bus error exception
A bus error exception occurs when a program references an inaccessible memory location, typically because
the reference is to an unaligned or nonexistent address, or because of a hardware failure.
The most likely cause of a bus error is unaligned data reference. A program that passes an array of
(KIND=1) elements to a routine that attempts to access them as (KIND=4) elements may take a bus error
exception. Or if an array of (KIND=1) elements is declared in a common block and the third element is
passed to a routine that attempts to access it as a (KIND=4) variable, the program will take a bus error
exception. For information about the alignment of HP Fortran data types, refer to the HP Fortran
Programmers Reference.
Bus errors can occur (as can other exceptions) in any program that generates bad address references.
Although less likely to happen with programs that use the standard Fortran 90 pointer, bad address
references can happen when the Cray-style pointer extension is misused or when Fortran program unit
passes a parameter by value to a C routine that attempts to use it as a pointer.
Floating-point exceptions
In accordance with the IEEE Posix Standard, floating-point exceptions are disabled on HP 9000 computers.
Thus, if a program attempts the following operation:
x = 1.0/0.0
it will not trap it as an exception and will not abort. Instead, the value of a positive infinity (displayed as
+INF) will be assigned to x.
HP Fortran provides two compile-line options, +FP and +fp_exception, which enable traps for
floating-point exceptions. The differences between the two options are:
The +fp_exception option enables traps for the following IEEE floating-point exceptions:
Invalid operation