From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28104 invoked by alias); 20 Jun 2014 07:44:22 -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 28061 invoked by uid 48); 20 Jun 2014 07:44:17 -0000 From: "xinliangli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/61571] New: bad aliasing --> wrong FRE Date: Fri, 20 Jun 2014 07:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xinliangli at gmail dot com 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 bug_severity priority component assigned_to reporter 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-06/txt/msg01664.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61571 Bug ID: 61571 Summary: bad aliasing --> wrong FRE Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: xinliangli at gmail dot com Compile the attached source with -m32 -std=c++11 -O2 on x86, the program will crash. It runs fine with -m32 -std=c++11 -O2 -fno-tree-pre -fno-tree-fre. (same failure is also observed on arm target). The bad FRE happens in list::merge function. list::splice needs to be inlined to trigger the bad CSE. The problematic CSE is this one: list::merge (...) { if (this != &__c) { iterator __f1 = begin(); iterator __e1 = end(); iterator __f2 = __c.begin(); // this one ... while (...) { } // inline instance of splice: if (!__c.empty()) { __node_pointer __f = __c.__end_.__next_; // and this one __node_pointer __l = __c.__end_.__prev_; base::__unlink_nodes(__f, __l); __link_nodes(__p.__ptr_, __f, __l); base::__sz() += __c.__sz(); __c.__sz() = 0; } Note begin() method accesses __c.__end_.__next_.