https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118924
--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 19 Feb 2025, pinskia at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118924 > > --- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- > The reason why it works with the C front-end is actaully because of > r9-6782-g2a82beaa820410. There C front-end explictly makes enum and the > underlying integer types have the same aliasing set. > > So the question is should C++ have the same treatment or is that another > difference. Plus reading the std-discussion is that C++ is difference from C > here. > > Still the array assignment is wrong from the front-end. And still SRA should not use a random RHS "model" to build a new LHS access, most definitely not when the original aggregate LHS isn't TBAA compatible with it. Whether the testcaes from the C PR are valid in C++ is an entirely different question (it would of course hide the SRA issue seen here). The array assignment from the front-end is good enough for the middle-end as far as IL type hygiene is concerned given the element types are useless-type-convertible.