If a program gets an exception, there are many possible causes. One approach to locating the problem is to find the line number in the source program where the exception occurred, and then look for clues there.
Compiling with --ftrap =%all forces trapping on all exceptions.
Find where an exception occurred:
demo% cat wh.f call joe(r, s) print *, r/s end subroutine joe(r,s) r = 12. s = 0. return end demo% f77 -g -o wh -ftrap=%all wh.f wh.f: MAIN: joe: demo% dbx wh Reading symbolic information for wh (dbx) catch FPE (dbx) run Running: wh (process id 17970) signal FPE (floating point divide by zero) in MAIN at line 2 in file "wh.f" 2 print *, r/s (dbx)