From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15781 invoked by alias); 29 Nov 2012 00:41:52 -0000 Received: (qmail 15678 invoked by uid 48); 29 Nov 2012 00:41:37 -0000 From: "aoliva at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libmudflap/53952] [4.8 Regression] FAIL: libmudflap.c++/pass55-frag.cxx ( -O[123]) execution test Date: Thu, 29 Nov 2012 00:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libmudflap X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aoliva at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-11/txt/msg02812.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53952 Alexandre Oliva changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-11-29 CC| |aoliva at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #1 from Alexandre Oliva 2012-11-29 00:41:36 UTC --- The problem is that SRA replaces a copy of an iterator type to a variable that was not addressable with a copy of the pointer held in the iterator. To that end, it takes the address of the iterator. This takes place after mudflap1, so that the address range for the variable is never registered, but before mudflap2, that introduces the access checks for addressed variables and marking them addressable. Oops. (it's the iterator passed to _M_insert_aux, in the copy of push_back inlined into main) This ugly patch fixes it, but I don't really like it. Any other suggestions? --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -933,6 +933,12 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp, return; } + /* SRA takes the address of variables that were not addressable. + Don't check them. */ + if (TREE_CODE (addr) == ADDR_EXPR + && !TREE_ADDRESSABLE (TREE_OPERAND (addr, 0))) + return; + mf_build_check_statement_for (base, limit, iter, location, dirflag); } /* Transform