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?
Richard Henderson wrote:
> Try
>
> cst_uchar_ptr_node
> = build_pointer_type_for_mode (cst_uchar_node, ptr_mode, true);
>
> which is apparently in use by the Ada front end, but only if a
> certain pragma is given. Dunno how reliably that's likely to work.
We are seeing regressions in our local testsuite on cases exercising
that pragma.
Passing 'true' as CAN_ALIAS_ALL sets TYPE_REF_CAN_ALIAS_ALL (t), but
this apparently has no influence on what tree-ssa-alias computes.
Out of a preliminary look into this code (new to me), a possible place
to address that appears to be 'get_tmt_for', which presumably should assign
a zero alias set to tags for pointer types with that bit set.
The current code doesn't do that:
tree tag_type = TREE_TYPE (TREE_TYPE (ptr));
HOST_WIDE_INT tag_set = get_alias_set (tag_type);
I'd be happy to work-on and submit a patch to deal with this the proper
way. I'd welcome hints or directions on what the proper way should be, as
I don't yet have a global view of the complete alias analysis circuitry.
The 'tag alias set should be zero if ...' idea above seems logical to me.
I still may well not yet see a number of other options.