https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101641
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2021-07-27 Status|UNCONFIRMED |ASSIGNED Keywords| |wrong-code --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- We're already going great lengths trying to preserve stores that change the dynamic type in a way relevant for downstream users (which we actually do not see). In particular we've settled to alias_set_type set = ao_ref_alias_set (&lhs_ref); alias_set_type base_set = ao_ref_base_alias_set (&lhs_ref); if ((vnresult->set != set && ! alias_set_subset_of (set, vnresult->set)) || (vnresult->base_set != base_set && ! alias_set_subset_of (base_set, vnresult->base_set))) resultsame = false; but this case is so degenerate that all the alias sets and base alias sets of both pu->y (vnresult) and pu->x (lhs_ref) are 2 since we use the alias set of the union type for all accesses that have the union in their path. The only remaining chance we have here is to look at the actual types and reject punning attempts. We are really missing a way to preserve the TBAA effect of a store but not the store itself.