[Bug c++/98322] optimizes to false instead true
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 16 17:41:47 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98322
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, folding it to return false; is the right thing.
~a ^ b is ~(int) (a ^ b) in C++, so if a == b, it is ~0 (on two's complement
-1),
and if a != b, then it is ~1 (on two's complement -2).
1 != -1
and
0 != -2
so it is always false.
More information about the Gcc-bugs
mailing list