--- Comment #9 from rguenth at gcc dot gnu dot org 2009-10-05 13:09 ---
with 64bit int the multiplication will never overflow, so it would work there
as well.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41577
--- 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
--- Comment #7 from rguenth at gcc dot gnu dot org 2009-10-05 12:03 ---
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.
--
http://gcc.gnu.org/bug
--- Comment #6 from rguenth at gcc dot gnu dot org 2009-10-05 12:02 ---
Actually the testcase is invalid.
uint32 res = ((uint16)(cpu->gprs[12] >> 16) * (uint16)(cpu->gprs[16]
>> 16));
performs a signed multiplication which invokes undefined behavior if it
overflows. Thus the
--- Comment #5 from rguenth at gcc dot gnu dot org 2009-10-05 11:59 ---
A workaround is to provide -fno-tree-vrp.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41577
--- Comment #4 from rguenth at gcc dot gnu dot org 2009-10-05 11:59 ---
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
Status|UNCON