You need to do two things. First, to stop the process whenever an FP exception occurs, type:
(dbx) catch FPE
Next, add the following to your Fortran application:
integer ieeer, ieee_handler, myhandler ieeer = ieee_handler('set', 'all', myhandler) ... integer function myhandler(sig, code, context) integer sig, code(5) call abort() end
This is necessary because the ieee software typically sets all errors to be silent (not raising signals). This causes all ieee exceptions to generate a SIGFPE as appropriate, which is probably too much.
You can further tailor which exceptions you see by adjusting the parameters of ieee_handler() or by using an alternative to the dbx catch command:
stop sig FPE
which acts just like catch FPE, or
stop sig FPE subcode
For finer control, subcode can be one of the following:
FPE_INTDIV | 1 | integer divide by zero |
FPE_INTOVF |
2 |
integer overflow |
FPE_FLTDIV |
3 |
floating point divide by zero |
FPE_FLTOVF |
4 |
floating point overflow |
FPE_FLTUND |
5 |
floating point underflow |
FPE_FLTRES |
6 |
floating point inexact result |
FPE_FLTINV |
7 |
invalid floating point operation |
FPE_FLTSUB |
8 |
subscript out of range |
Note that stop and catch are independent and that if you use stop FPE you should also ignore FPE.