From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1651 invoked by alias); 12 Mar 2007 12:23:09 -0000 Received: (qmail 1618 invoked by uid 48); 12 Mar 2007 12:22:58 -0000 Date: Mon, 12 Mar 2007 12:23:00 -0000 Subject: [Bug tree-optimization/31146] New: forwprop does not look through casts X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg01047.txt.bz2 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