[Bug c++/103699] Reading or writing a constant unaligned value is wrongly optimized causing an incorrect result (GCC-11 and up)
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 14 00:42:15 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103699
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |INVALID
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Basically you have an aliasing violation.
You are writing as an uint64_t but then reading as uint32_t.
Use either -fno-strict-aliasing or add may_alias attribute to UnalignedUInt32
and UnalignedUInt64.
More information about the Gcc-bugs
mailing list