[Bug c++/106542] -O2 sign-extended uint32 to uint64
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Aug 6 03:58:23 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106542
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code is undefined as the subtraction is done in the int type.
You either need to use -fwrapv or cast to an unsigned type before doing the
subtraction.
More information about the Gcc-bugs
mailing list