program uses the ON statement to handle
Example 18 Example
PROGRAM main
ON REAL OVERFLOW IGNORE
CALL take_err
END PROGRAM main
SUBROUTINE take_err
DOUBLE PRECISION :: d
POINTER (ip, d) !
REAL :: x, y
INTEGER, PARAMETER :: sigbus=10, sigdfl=0
INTEGER :: sigrtn, SIGNAL
!Set the action for bus error to be the default (DUMP CORE),
!overriding the action of issuing a procedure traceback
!that is established by using the ON statement.
!To suppress the core dump and enable a procedure traceback,
! | comment out the next statement sigrtn = SIGNAL(sigbus, 0, sigdfl) x = 1.0E38 x = y * 10.0 | ! | ||
causes | a real overflow |
| ||
! | Bus error is caused by the next statements |
| ||
ip = | MALLOC(40) |
|
| |
ip = | ip + 4 | ! ip is now |
|
! bus error
END SUBROUTINE take_err
This program must be compiled with the +U77option to link in the libU77library. Here is the command line and the output from a sample run:
$ f90 +U77 allow_core.f90 $ a.out
Bus error(coredump) $ ls corecore
86 Using the ON statement