This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/41577] Broken code with -O -ftree-vrp
- From: "magnus dot christensson at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Oct 2009 12:36:41 -0000
- Subject: [Bug tree-optimization/41577] Broken code with -O -ftree-vrp
- References: <bug-41577-16469@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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