------- Comment #6 from jv244 at cam dot ac dot uk 2009-08-27 16:01 ------- this is bold guess at a patch, which does fix the lineno info for this testcase, but no idea if this is even remotely correct. Based on the observation that gfc_match_function_decl sets declared_at, but gfc_match_subroutine does not.
Index: decl.c =================================================================== --- decl.c (revision 151059) +++ decl.c (working copy) @@ -5047,7 +5047,10 @@ match is_bind_c; char peek_char; bool allow_binding_name; + locus old_loc; + old_loc = gfc_current_locus; + if (gfc_current_state () != COMP_NONE && gfc_current_state () != COMP_INTERFACE && gfc_current_state () != COMP_CONTAINS) @@ -5147,6 +5150,8 @@ /* Warn if it has the same name as an intrinsic. */ warn_intrinsic_shadow (sym, false); + sym->declared_at=old_loc; + return MATCH_YES; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823