This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/31146] New: forwprop does not look through casts
- 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: 12 Mar 2007 12:22:58 -0000
- Subject: [Bug tree-optimization/31146] New: forwprop does not look through casts
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following two testcases should produce the same code after forwprop1:
struct foo { int i[3]; };
void bar (void)
{
struct foo Foo;
int i;
for (i=0; i<3; ++i)
{
void *p = &Foo.i[i];
int *pi = (int *)p;
if (pi != 0)
{
*pi = 0;
}
}
}
---
struct foo { int i[3]; };
void bar (void)
{
struct foo Foo;
int i;
for (i=0; i<3; ++i)
{
void *p = &Foo.i[i];
int *pi = (int *)p;
if (p != 0)
{
*pi = 0;
}
}
}
(the difference is testing p != 0 vs. pi != 0)
This happens in tramp3d-v4 via placement new:
for (i=0; i<3; ++i)
new (&a[i]) double;
where placement new expands to the "wrong" test sequence.
Mine.
--
Summary: forwprop does not look through casts
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: rguenth at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31146