This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/69984] [4.9/5/6] Signed comparison instruction emitted for unsigned variable comparison


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]