https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116912
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note you should also read https://gcc.gnu.org/bugs/ which has this: Similarly, if compiling with -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations makes a difference, or if compiling with -fsanitize=undefined produces any run-time errors, then your code is probably not correct.