------- Comment #3 from jv244 at cam dot ac dot uk 2009-08-26 21:00 ------- I've maybe some insight why this is happening, compiling just the module. By putting a breakpoint on gfc_set_backend_locus, the break is on
#0 gfc_set_backend_locus (loc=0x12f28b0) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/trans.c:1052 #1 0x000000000054e9fa in build_function_decl (sym=0x12f28a0) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/trans-decl.c:1571 #2 0x000000000054faaf in gfc_create_function_decl (ns=0x12f51d0) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/trans-decl.c:2131 #3 0x0000000000536948 in gfc_generate_module_code (ns=0x12f1c90) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/trans.c:1337 which is 1569 /* Set the line and filename. sym->declared_at seems to point to the 1570 last statement for subroutines, but it'll do for now. */ 1571 gfc_set_backend_locus (&sym->declared_at); and the line number in the location is (gdb) call expand_location(loc->lb->location).line $43 = 2 i.e. the offending line, and not the line where the subroutine has been declared (line 4). The attribute public is specified at line 2, so maybe the declared_at is being set when the public attribute is being parsed? That would be consistent with the observation that commenting the PUBLIC line, all debug lineinfo seems right in the gimple dump. I suspect that (re)setting the declared_at field with the SUBROUTINE is matched could fix this bug... but can't follow my way through parse.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823