From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24935 invoked by alias); 5 Feb 2007 13:21:02 -0000 Received: (qmail 24883 invoked by uid 48); 5 Feb 2007 13:20:50 -0000 Date: Mon, 05 Feb 2007 13:21:00 -0000 Subject: [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub 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-02/txt/msg00698.txt.bz2 struct obj_symbol { struct obj_symbol *next; unsigned int size; }; struct common_entry { struct common_entry *next; struct obj_symbol *sym; }; extern void do_something(struct obj_symbol *sym); void obj_allocate_commons(struct obj_symbol *sym) { struct common_entry *common_head = ((void *)0); for (; sym ; sym = sym->next) { struct common_entry **p, *n; for (p = &common_head; *p ; p = &(*p)->next) if (sym->size <= (*p)->sym->size) break; n = __builtin_alloca (sizeof(*n)); n->next = *p; n->sym = sym; *p = n; } { struct common_entry *p; for (p = common_head; p ; p = p->next) do_something(p->sym); } } is miscompiled on gcc-4_1-branch at least on x84_64-linux, with -O2 and above (but not with -fno-strict-aliasing). The common_head = NULL initialization is removed as dead during 1st DCE pass, but from quick skimming the reason for that seems to be incorrect aliasing information. -- Summary: [4.1 Regression] Aliasing miscompilation Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30708