This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36300] Incorrect type used for inlined expression
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 May 2008 16:10:39 -0000
- Subject: [Bug c/36300] Incorrect type used for inlined expression
- References: <bug-36300-16214@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from rguenth at gcc dot gnu dot org 2008-05-22 16:10 -------
t = (int) ((long int) U1 * 3 >> 2) + 2;
Y = (int) ((long int) (t * t) * 954437177 >> 29);
if combined is folded to
Y = (int) (((long int) (int) ((long int) U1 * 3 >> 2) * 954437177 +
1908874354) * (long int) ((int) ((long int) U1 * 3 >> 2) + 2) >> 29);
We can see that for
int foo(int x)
{
return (long)(((int)((long)x * 3) + 2) * (int)((long)x * 3)) * 2;
}
the conversion to long is distributed on the operands and the
multiplication by 2 is then re-associated.
I bet this is extract_muldiv at its work again.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Known to fail| |4.1.3 4.2.4 4.3.0
Last reconfirmed|0000-00-00 00:00:00 |2008-05-22 16:10:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36300