http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45777
--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-30
16:15:36 UTC ---
(In reply to comment #8)
> (In reply to comment #7)
> > I think we should be doing the checking against the
> > typespec of the component. The component looks reasonable:
> >
> [...]
> >
> > but the sym just has
> >
> [...]
>
> According to how it is used, it seems that u.c.sym is the component's derived
> type. And the dump you show doesn't contradict that (name="t1", empty type
> specification, ...). What's wrong ?
The way we use it is wrong.
In gfc_could_be_alias, we call gfc_symbols_could_alias to check
possible aliases, like this:
for (rref = rss->expr->ref; rref != rss->data.info.ref; rref = rref->next)
{
if (rref->type != REF_COMPONENT)
break;
if (gfc_symbols_could_alias (rref->u.c.sym, lsym))
return 1;
}
gfc_symbols_could_alias then checks, based on type, if the two
symbols could alias. Unfortunately, the relevant type information is
lacking in rref->u.c.sym, so this check is a no-op.
For this test case, we need to perform a check on the type information
in the component, instead.