http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47240
--- Comment #7 from janus at gcc dot gnu.org 2011-01-11 14:43:52 UTC ---
(In reply to comment #5)
> > Index: gcc/fortran/resolve.c
> > ===================================================================
> > --- gcc/fortran/resolve.c (revision 168618)
> > +++ gcc/fortran/resolve.c (working copy)
> > @@ -4858,6 +4858,9 @@ expression_rank (gfc_expr *e)
> >
> > for (ref = e->ref; ref; ref = ref->next)
> > {
> > + if (ref->type == REF_COMPONENT)
> > + rank = ref->u.c.component->as ? ref->u.c.component->as->rank : 0;
> > +
> > if (ref->type != REF_ARRAY)
> > continue;
>
> ... this produces loads of regressions.
... but the following variant doesn't:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 168655)
+++ gcc/fortran/resolve.c (working copy)
@@ -4858,6 +4858,9 @@ expression_rank (gfc_expr *e)
for (ref = e->ref; ref; ref = ref->next)
{
+ if (ref->type == REF_COMPONENT && !ref->next)
+ rank = ref->u.c.component->as ? ref->u.c.component->as->rank : 0;
+
if (ref->type != REF_ARRAY)
continue;