This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Ada and TBAA and arrays vs. VIEW_CONVERT_EXPRs
On Mon, 9 Feb 2009, Richard Kenner wrote:
> > The problem is that in Gigi you are copying alias sets from a
> > TYPE_NONALIASES_COMPOMENT type to a non-TYPE_NONALIASES_COMPOMENT type.
>
> That indeed shouldn't happen because of the way Ada is defined (you
> only copy alias sets among derived types and all derived types should
> have the same Aliased status with respect to its component type) , but
> there may well be a bug.
>
> However, the "Gigi change" I was talking about in my email was that of
> setting that flag for string literals.
>
> > As non-TYPE_NONALIASES_COMPOMENT expect their element alias-set to be
> > the same as the array alias-set
>
> That I still think is wrong. I think it should be the same as for records:
> the alias set of the aggregate type should be distinct from that of its
> element and a subsetting should be set up (as we still do for records).
> If Fortran (or any other language), has additional requirements, it can
> manually set the alias set of the array as needed (as Ada does in
> some cases).
The difference between arrays and records is that an array can at most
have a single subset while a record can have multiple. So if you
need both-way subsetting just using the same alias set is very cheap
and exactly as precise as bot-way subsetting for the array case. Note
that we do the same for vector types.
Richard.