------- Comment #1 from janus at gcc dot gnu dot org  2010-03-10 22:06 -------
Here is a simple-minded patch:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 157366)
+++ gcc/fortran/resolve.c       (working copy)
@@ -5555,6 +5555,8 @@
 gfc_resolve_expr (gfc_expr *e)
 {
   gfc_try t;
+  gfc_typespec ts;
+  gfc_ref *ref = NULL;

   if (e == NULL)
     return SUCCESS;
@@ -5584,7 +5586,14 @@
       break;

     case EXPR_COMPCALL:
-      if (e->symtree && e->symtree->n.sym->ts.type == BT_CLASS)
+      if (e->symtree)
+       ts = e->symtree->n.sym->ts;
+      for (ref = e->ref; ref; ref = ref->next)
+       {
+         if (ref->type == REF_COMPONENT)
+           ts = ref->u.c.component->ts;
+       }
+      if (ts.type == BT_CLASS)
        t = resolve_class_compcall (e);
       else
        t = resolve_compcall (e, true);


This fixes the test case. Haven't tested for regressions yet.


-- 


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

Reply via email to