https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106389

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #4)
> (In reply to Richard Biener from comment #3)
> > For the rule to take effect the frontend needs to mark each access that
> > falls under the rule as to have alias-set zero.
> 
> Something like: make c_common_get_alias_set return -1 for those
> COMPONENT_REFs in a standard-layout union that share a common initial
> sequence, and are standard-layout structs?

return 0, not -1 for them.  But note to be reliable you'd have to do this
for the actual aggregate type, not just COMPONENT_REFs since we have to
be able to re-query TBAA from the types (and COMPONENT_REFs might get lost).
See also the response from Honza.

union U { struct A { int i; } a; struct B { int i; int f; } b; } u;

is 'u.a' accessing the common initial sequence of A and B btw.?

Reply via email to