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 Sun, 8 Feb 2009, Eric Botcazou wrote:
> > Yes, A[i] and A are not disambiguated without TBAA unless the frontend
> > explicitly allows this. Citing from get_alias_set:
> >
> > /* Unless the language specifies otherwise, treat array types the
> > same as their components. This avoids the asymmetry we get
> > through recording the components. Consider accessing a
> > character(kind=1) through a reference to a character(kind=1)[1:1].
> > Or consider if we want to assign integer(kind=4)[0:D.1387] and
> > integer(kind=4)[4] the same alias set or not.
> > Just be pragmatic here and make sure the array and its element
> > type get the same alias set assigned. */
> > else if (TREE_CODE (t) == ARRAY_TYPE
> > && !TYPE_NONALIASED_COMPONENT (t))
> > set = get_alias_set (TREE_TYPE (t));
> >
> > the problems with other languages were simply too big. The gimplifier
> > problem hints into the same direction here. Thus, the above means
> > that if it is legal to take the address of an element both the
> > array and the element will share their alias sets (which is always
> > for any language but Ada and Java).
>
> OK but there are no addresses in the example, just direct accesses A[i] and A.
> They are memory references with the same base DECL so they should conflict,
> otherwise TYPE_NONALIASED_COMPONENT cannot possibly work.
Right, A[i] and A are direct accesses and TREE_ADDRESSABLE is not set.
But their alias sets do _not_ conflict. For whatever reason.
Richard.