[Bug fortran/40823] debug info points to unexpected line
--- Comment #11 from mikael at gcc dot gnu dot org 2010-04-19 17:54 --- *** Bug 39991 has been marked as a duplicate of this bug. *** -- mikael at gcc dot gnu dot org changed: What|Removed |Added CC||dfranke at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
-- hjl dot tools at gmail dot com changed: What|Removed |Added Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- Comment #10 from burnus at gcc dot gnu dot org 2010-02-10 16:49 --- FIXED on the trunk (4.5). Thanks for the draft patch! -- burnus at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- Comment #9 from burnus at gcc dot gnu dot org 2010-02-10 16:48 --- Subject: Bug 40823 Author: burnus Date: Wed Feb 10 16:48:24 2010 New Revision: 156665 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156665 Log: 2010-02-10 Joost VandeVondele Tobias Burnus PR fortran/40823 * decl.c (gfc_match_subroutine): Explicitly set * sym->declared_at. 2010-02-10 Tobias Burnus PR fortran/40823 * gfortran.dg/private_type_1.f90: Update error location. * gfortran.dg/invalid_interface_assignment.f90: Ditto. * gfortran.dg/typebound_operator_2.f03: Ditto. * gfortran.dg/assignment_2.f90: Ditto. * gfortran.dg/redefined_intrinsic_assignment.f90: Ditto. * gfortran.dg/binding_label_tests_9.f03: Ditto. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/assignment_2.f90 trunk/gcc/testsuite/gfortran.dg/binding_label_tests_9.f03 trunk/gcc/testsuite/gfortran.dg/invalid_interface_assignment.f90 trunk/gcc/testsuite/gfortran.dg/private_type_1.f90 trunk/gcc/testsuite/gfortran.dg/redefined_intrinsic_assignment.f90 trunk/gcc/testsuite/gfortran.dg/typebound_operator_2.f03 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- Comment #8 from burnus at gcc dot gnu dot org 2010-02-10 09:33 --- (In reply to comment #6) > 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. In principle, it should not be needed to set the declared_at as gfc_match_subroutine calls gfc_get_symbol, which calls gfc_get_sym_tree which calls gfc_new_symbol which contains: p->declared_at = gfc_current_locus; At that point, gfc_current_locus should be at the end of the subroutine name. -- Eureka! I know understand why this is not happening: As the symbol is already defined (due to the PUBLIC statement), declared_at is not re-set. Thus, it indeed makes sense to add a sym->declared_at - either as in the patch does at >se< by simply using "sym->declared_at = gfc_current_locus;". > + old_loc = gfc_current_locus; [...] > + sym->declared_at=old_loc; >return MATCH_YES; -- burnus at gcc dot gnu dot org changed: What|Removed |Added CC||burnus at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-02-10 09:33:30 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- Comment #7 from jv244 at cam dot ac dot uk 2010-02-10 09:10 --- still happens with current trunk. I believe the patch below is still fine. -- jv244 at cam dot ac dot uk changed: What|Removed |Added Keywords||patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- 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
[Bug fortran/40823] debug info points to unexpected line
--- Comment #5 from jv244 at cam dot ac dot uk 2009-08-27 15:35 --- more debug info .. if I declare S1 to be a function instead of a subroutine, lineno is also correct anybody with [parse.]c experience willing to take over ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823
[Bug fortran/40823] debug info points to unexpected line
--- Comment #4 from jv244 at cam dot ac dot uk 2009-08-27 06:50 --- changing component since this really looks like a FE issue -- jv244 at cam dot ac dot uk changed: What|Removed |Added Component|debug |fortran http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823