This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Aliasing violation generated by fold_builtin_memcmp?
On Fri, 2005-09-30 at 16:53 +0200, Olivier Hainque wrote:
> Daniel Berlin wrote:
> > Well, doesn't the pointed-to type have set 0 because of
> > TYPE_REF_CAN_ALIAS_ALL (or whatever it's named :P)?
>
> Not quite: the pointer type has TYPE_REF_CAN_ALIAS_ALL, not the
> pointed-to type:
>
> /* Nonzero in a pointer or reference type means the data pointed to
> by this type can alias anything. */
> #define TYPE_REF_CAN_ALIAS_ALL(NODE) \
> (PTR_OR_REF_CHECK (NODE)->common.static_flag)
>
> It seems to me that get_tmt does not do the right thing today
> because it assigns the tag alias set from the alias set of the
> pointed-to type, even if CAN_ALIAS_ALL is set on the pointer type.
Uh, CAN_ALIAS_ALL seems like a very bad hack then.
You should simply be creating a pointed-to type that aliases set 0, and
using that for the pointed to type.
That is, after all, what alias set 0 is for.