https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111231
--- Comment #39 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Richard Earnshaw from comment #34) > To be honest, I'm more concerned that we aren't eliminating a lot of these > copies during the gimple optimization phase. The memcpy is really a type > punning step (that's strictly ISO C compliant, rather than using the GCC > union extension), so ideally we'd recognize that and eliminate as many of > the copies as possible (perhaps using some form of view_convert or whatever > gimple is appropriate for changing the view without changing the contents). > > But that's for another day... I will be looking into improving the situation here in the next couple of weeks. I noticed a few patterns for this code which I will file tomorrow and link back in the see also. Note Gcc 16 does remove at least a few copies but not the memcpy ones.