https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91708
--- Comment #20 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Richard Earnshaw from comment #19) > (In reply to Wilco from comment #18) > > (In reply to Richard Earnshaw from comment #17) > > > So do we have a testcase that shows the problem on older compilers? > > > > Yes, the same testcase shows the same incorrect substitution in older > > compilers. I tried GCC9, but the MEM to MEM change dates back much further. > > Right, but does it lead to wrong code? It seemed to me that the compiler > loses the correct alignment internally, but the object is really still > aligned so nothing harmful happens. It's not the alignment that is the main issue but the aliasing is wrong - an unaligned access will still execute correctly on a modern CPU.