------- 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
  >s<ubroutine
or after successfully getting the symbol setting it to at
  subroutine nam>e<
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|0000-00-00 00:00:00         |2010-02-10 09:33:30
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823

Reply via email to