While testing my patch for PR33502, I discovered that the Fortran front-end emits wrong location when configured with --enable-mapped-location: the line numbers are OK, but the file name is wrong for the the outer file locations after the inclusion.
The following is the behaviour with an --enable-mapped-location compiler; notice that we believe to be at line 3 in inc1.f90, while we're in foo.F90 (and this triggers the "Line number 3 out of range; inc1.f90 has 1 lines" message). $ cat foo.F90 print *, 11 #include "inc1.f90" print *, 13 end $ cat inc1.f90 print *, 12 $ gfortran -g foo.F90 $ gdb -quiet ./a.out Using host libthread_db library "/lib/libthread_db.so.1". (gdb) b MAIN__ Breakpoint 1 at 0x401ea7: file foo.F90, line 1. (gdb) r Starting program: /home/fxcoudert/devel/debug/irun/a.out Breakpoint 1, MAIN__ () at foo.F90:1 1 print *, 11 Current language: auto; currently fortran (gdb) n 11 1 print *, 12 (gdb) where #0 MAIN__ () at inc1.f90:1 (gdb) n 12 Line number 3 out of range; inc1.f90 has 1 lines. (gdb) where #0 MAIN__ () at inc1.f90:3 -- Summary: Wrong locations emitted with mapped locations and included files Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-debug Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33528