Debugging
Revision as of 09:16, 1 March 2008 by GethinWilliams (talk | contribs) (→Getting the content for the practical)
Debugging you program: Various techniques
Getting the content for the practical
Login to your favourite linux box and type:
svn export http://source.ggy.bris.ac.uk/subversion-open/debugging/trunk ./debugging
A Common Bug: going beyond the boundaries on array
We will start with a pretty common coding problem: we have an array and a loop which access elements of that array in turn. The problem is that we've made a mistake with our loop and it tries to access elements beyond the boundaries of our array.
Let's take a look and compile up the code using the open-source g95 and gfortran, and compilers.
We get a segmentation fault.
Now the Portland group compiler..not so lucky!
Now using the ifort compiler...different again.
Interesting, huh?
Still using ifort, let's look at the difference when we add:
- -traceback
- -CB
to the compilation flags (see Makefile).
Argument Mismatch
The best way to combat this is to put the subroutines into a module.