https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115437
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- There is an alias violation here. Use -fno-strict-aliasing or as you shown use the correct pointer type originally. That is stores to `uint8_t *` and loads from `char *` are considered different aliasing sets and GCC optimizes based on that.