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?
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.
Here is an example input tree out of an Ada testcase:
<var_decl 0x4022f370 ksubint.2
type <pointer_type 0x4025fbdc p2__integer_access
type <integer_type 0x4025fb80 integer type <integer_type integer>
sizes-gimplified public SI
user align 32 symtab 0 alias set 3
sizes-gimplified public static unsigned SI
^^^^^^
user align 32 symtab 0 alias set -1>
This is a pointer to integer which is declared "can actually alias anything".