From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16003 invoked by alias); 6 Aug 2014 05:08:12 -0000 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 Received: (qmail 15920 invoked by uid 48); 6 Aug 2014 05:08:06 -0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/62030] New: wrong code due to aliasing issue Date: Wed, 06 Aug 2014 05:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter blocked cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-08/txt/msg00327.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62030 Bug ID: 62030 Summary: wrong code due to aliasing issue Product: gcc Version: 4.10.0 Status: UNCONFIRMED Keywords: alias, wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Blocks: 61964 Target: mipsisa64-elf With a slightly modified version of the testcase for PR 61964 (I have an optimization pass which does the optimization but I can confirm it with an upstream GCC with the modified source), I get the failure on mipsisa64-elf. Here is the testcase: /* { dg-do run } */ extern void abort (void); struct node { struct node *next, *prev; } node; struct head { struct node *first; } heads[5]; int k = 2; struct head *head = &heads[2]; static int __attribute__((noinline)) foo() { node.prev = (void *)head; head->first = &node; struct node *n = head->first; struct head *h = &heads[k]; struct node *next = n->next; if (n->prev == (void *)h) h->first = next; else n->prev->next = next; n->next = h->first; return n->next == &node; } int main() { if (foo ()) abort (); return 0; } Compile with -O2 -march=octeon to see the failure. CE1 is where the combining of the two stores happen.