From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20031 invoked by alias); 27 May 2008 12:42:46 -0000 Received: (qmail 19941 invoked by uid 48); 27 May 2008 12:42:03 -0000 Date: Tue, 27 May 2008 12:42:00 -0000 Subject: [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering 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: 2008-05/txt/msg01978.txt.bz2 extern void abort (void); void __attribute__((noinline)) bar (int **p) { float *q = (float *)p; *q = 0.0; } float __attribute__((noinline)) foo (int b) { int *i = 0; float f = 1.0; int **p; if (b) p = &i; else p = (int **)&f; bar (p); if (b) return **p; return f; } int main() { if (foo(0) != 0.0) abort (); return 0; } We TBAA-prune the points-to-set of p due to the dereference *p but use the pruned points-to-set for computing the call-clobber variables which causes f not to be call-clobbered. Thus we return 1.0 from foo. Oops. -- Summary: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering Product: gcc Version: 4.3.1 Status: UNCONFIRMED Keywords: wrong-code, alias Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36343