This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2008 21:16:06 -0000
- Subject: [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition
- References: <bug-37242-7849@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-08-26 21:16 -------
>This could be due to array indexing lowered to POINTER_PLUS_EXPR.
Array indexing is never lowered using POINTER_PLUS_EXPR, only for pointers it
is. Though it looks like
we are doing the math in unsigned in one case but signed in another but we
don't consider them the same for PRE.
Simple testcase:
int f(int a)
{
unsigned b = a;
b++;
a++;
return a + b;
}
We should just get return a*2 + 2; (which we do at the RTL level) but we get:
b = (unsigned int) a;
return (int) ((b + 1) + (unsigned int) (a + 1));
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-08-26 21:16:06
date| |
Summary|missed FRE opportunity |missed FRE opportunity
| |because of signedness of
| |addition
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242