https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119085
--- Comment #5 from pipcet at protonmail dot com --- (In reply to Richard Biener from comment #3) > Total scalarization of a union looks dubious unless it uses ref-all and of > course copies the whole storage. I think the problem is that the representative access chosen in sort_and_splice_var_accesses won't be the union copy (which would copy the whole storage) but the copy of the member struct (which doesn't). Making that function choose the union copy (if there is one, and we can detect it) fixes the problem, without giving up on scalarization for the entire access group, but I don't know how to do it properly, and what to do if there is no union copy to be chosen.