Debugging Advice
This page is mostly a place-holder in order to show that I have some distant intention of writing something sensible about how to do debugging on UNIX systems. The notes below are rather terse, and thus of use to those who already know the answers.
Part 1: read the compiler man page
Perhaps the compiler will do it for you. F90 compilers usually have run-time bounds checking (with a run-time performance penalty), and usually have additional compile-time warnings which are off by default. Maybe a different compiler will do it for you: try several. If the bug stays in the same place with all compilers and architectures, it is probably an error in the logic of your code. If it moves, it is probably a memory over-writing problem. If it disappears with some combinations, you will blame the compiler. It is still probably a memory over-writing issue in your code though.
Part 2: examine a core file
If you can get your hands on one (maybe using limit/ulimit and, for F90, perhaps setting some environment variable), and the executable was compiled with debugging info (-g) it ought to be possible to discover the line on which the crash occured, and the values of local variables, using gdb (or iidb if using the Intel compilers). It might not be, if the bug has caused significant stack corruption. One can also try running under a debugger, setting break-points based on code lines or variable values.
Part 3: additional tools
Include valgrind and Electric Fence. I really out to write something about them.