This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/31146] forwprop does not look through casts
- 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: 12 Mar 2007 15:09:17 -0000
- Subject: [Bug tree-optimization/31146] forwprop does not look through casts
- References: <bug-31146-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-03-12 15:09 -------
I should mention, unless it can produce a constant result.
For an example this function:
void bar (void * a)
{
struct foo Foo;
int i;
for (i=0; i<3; ++i)
{
void *p = a;
int *pi = (int *)p;
if (pi != 0)
{
*pi = 0;
}
}
}
Should not be transformed into:
void bar (void * a)
{
struct foo Foo;
int i;
for (i=0; i<3; ++i)
{
void *p = a;
int *pi = (int *)p;
if (p != 0)
{
*pi = 0;
}
}
}
As VRP is not as smart as there is no back tracking of ranges.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31146