This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47240] [F03] segfault with procedure pointer component
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Jan 2011 14:43:58 +0000
- Subject: [Bug fortran/47240] [F03] segfault with procedure pointer component
- Auto-submitted: auto-generated
- References: <bug-47240-4@http.gcc.gnu.org/bugzilla/>
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;