[Bug tree-optimization/41577] Broken code with -O -ftree-vrp
magnus dot christensson at acm dot org
gcc-bugzilla@gcc.gnu.org
Mon Oct 5 12:36:00 GMT 2009
------- Comment #8 from magnus dot christensson at acm dot org 2009-10-05 12:36 -------
(In reply to comment #7)
> A fix is to write
>
> uint32 res = ((uint32)(uint16)(cpu->gprs[12] >> 16)
> * (uint32)(uint16)(cpu->gprs[16] >> 16));
>
> instead to force the multiplication in an unsigned type.
>
Thanks. It wasn't obvious to me that a multiply on two unsigned variables would
be promoted to signed. The uint32 trick will work here, but won't work if your
target machine has 64-bit integers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41577
More information about the Gcc-bugs
mailing list