https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60952

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org
   Target Milestone|---                         |7.0

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> The first thing we need to find out is how exactly 'end' obtains the
> attribute VARIABLE.

That probably happens in 'match_variable', which is called during the parsing
process (along with many other routines, which try all sorts of matching).

In fact the only thing that's missing is to flag the symbol 'end' as a
PROCEDURE when parsing the type declaration. The following patch does just that
and fixes the errors on all three variants of the example code:

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (Revision 242341)
+++ gcc/fortran/decl.c  (Arbeitskopie)
@@ -9615,6 +9615,8 @@ match_procedure_in_type (void)
                            false))
        return MATCH_ERROR;
       gfc_set_sym_referenced (stree->n.tb->u.specific->n.sym);
+      gfc_add_flavor(&stree->n.tb->u.specific->n.sym->attr, FL_PROCEDURE,
+                    target, &stree->n.tb->u.specific->n.sym->declared_at);

       if (gfc_match_eos () == MATCH_YES)
        return MATCH_YES;

Reply via email to