When compiling the following code with gfortran (gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)) it is afterwards not possible to set a breakpoint on specific lines in the code:
$ cat main.F PROGRAM Test IMPLICIT NONE WRITE(*,*) 'Hello World' END $ gfortran -g -save-temps main.F -o main $ gdb main GNU gdb Red Hat Linux (6.3.0.0-1.84rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) l 1 # 1 "main.F" 2 # 1 "/home/taschna/gdbtest//" 3 # 1 "<built-in>" 4 # 1 "<command line>" 5 # 1 "main.F" 6 PROGRAM Test 7 IMPLICIT NONE 8 9 WRITE(*,*) 'Hello World' 10 (gdb) b 9 No line 9 in file "main.f". According to the comments in the gdb bug database to bug fortran/2048 <http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2048> this is a bug in gfortran, because the DW_TAG_compile_unit is set to 'main.f' which is a temporary file created by the compiler and therefore "should not be mentioned in debugging information". -- Summary: Wrong DW_TAG_compile_unit generated when compiling preprocessed fortran code Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: taschna at uni-muenster dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25324