------- Comment #5 from burnus at gcc dot gnu dot org  2009-10-25 14:33 -------
  print *, associated(a,f(a)) ! Valid, but error

If one steps in the debugger, one see that the TARGET= argument of associate
but "f", i.e. target->expr_type == EXPR_FUNCTION, target->symtree->n.sym->name
"f" and target->value.function->esym->name == "f".

Patch - not regtested, but seems to work.

--- resolve.c   (Revision 153537)
+++ resolve.c
@@ -1867,6 +1867,11 @@ resolve_generic_f0 (gfc_expr *expr, gfc_
        {  
          expr->value.function.name = s->name;
          expr->value.function.esym = s;
+         /* Copy attributes such that checking attr.pointer works, but keep
+            attr.generic as we do not (want to) copy all the other properties
+            of the specific.  */
+         expr->symtree->n.sym->attr = s->attr;
+         expr->symtree->n.sym->attr.generic = 1;
          if (s->ts.type != BT_UNKNOWN)
            expr->ts = s->ts;


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-25 14:33:13
               date|                            |


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

Reply via email to