[Bug tree-optimization/69984] [4.9/5/6] Signed comparison instruction emitted for unsigned variable comparison
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 29 17:23:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69984
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Even if the computation is 32-bit, by the time you multiply say (unsigned short
int) 0xffff with itself, you get undefined behavior.
So, as has been said, if you want to perform the multiplication in unsigned
long or unsigned int, you need to cast one of the operands.
More information about the Gcc-bugs
mailing list