The following sections discuss each of exceptions listed in
NOTE: Standard Fortran90 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, OPENand READ) in the HPFortran Programmer’s Reference. For a descriptive list of the error messages that can be returned byIOSTAT=, see the HPFortran Programmer’s Reference.
Bus error exceptionA 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, see the HPFortran Programmer’s 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 Fortran90 pointer, bad address references can happen when the
In accordance with the IEEE Posix Standard,
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.
HPFortran provides two
The +fp_exceptionoption enables traps for the following IEEE
❏Invalid operation
❏Division by zero
❏Division by zero
❏Overflow
❏Underflow
The +FP option also enables the trap for the inexact operation exception. For detailed descriptions of these exceptions, see the
•Unlike the +fp_exception option, the +FPoption includes a flags argument by which you can enable specific exceptions.
•The +FPoption can also be used to enable fast underflow on systems that support it (chiefly PA2.0 systems).
•Both options cause your program to abort when it traps the exception. However,
+fp_exception identifies the type of the exception that occurred and the virtual address of the statement that triggered it. Also, +FP causes a core dump;+fp_exception does not.
You can also trap
78 Debugging