GNU Fortran has various special options that are used for debugging
either your program or
A sample debugging session looks like this (note the use of the breakpoint):
$ cat gdb.f PROGRAM PROG DIMENSION A(10) DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./ A(5) = 4. PRINT*,A END $ g77 -g -O gdb.f $ gdb a.out ... (gdb) break MAIN__ Breakpoint 1 at 0x8048e96: file gdb.f, line 4. (gdb) run Starting program: /home/toon/g77-bugs/./a.out Breakpoint 1, MAIN__ () at gdb.f:4 4 A(5) = 4. Current language: auto; currently fortran (gdb) print a(5) $1 = 5 (gdb) step 5 PRINT*,A (gdb) print a(5) $2 = 4 ...One could also add the setting of the breakpoint and the first run command to the file
.gdbinitin the current directory, to simplify the debugging session.
See Options for Debugging Your Program or GCC, for more information on debugging options.