From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4058 invoked by alias); 25 Nov 2014 15:45:46 -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 3991 invoked by uid 48); 25 Nov 2014 15:45:42 -0000 From: "enkovich.gnu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/63995] Bootstrap error with -mmpx -fcheck-pointer-bounds Date: Tue, 25 Nov 2014 15:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: enkovich.gnu 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: Message-ID: In-Reply-To: References: 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-11/txt/msg03005.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63995 --- Comment #7 from Ilya Enkovich --- In chkpopt pass calls to bndmk are moved down to uses to decrease register pressure. Debug info introduces new uses and therefore it affects a position where bndmk calls appear. -g0 case: : r.field = -1; __bound_tmp.1_13 = __builtin_ia32_bndmk (&r, 4); test2.chkp (&r, __bound_tmp.1_13); -g case: : # DEBUG c => &r __bound_tmp.1_13 = __builtin_ia32_bndmk (&r, 4); # DEBUG __chkp_bounds_of_c => NULL r.field = -1; test2.chkp (&r, __bound_tmp.1_13); Will ignore debug statements when computing a new position for bounds load/creation (BTW debug statement seems to be damaged by gsi_move_before called for bndmk). Testing following fix: diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index ff390d7..b8d5d0b 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -1175,7 +1175,9 @@ chkp_reduce_bounds_lifetime (void) FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op) { - if (dom_bb && + if (is_gimple_debug (use_stmt)) + continue; + else if (dom_bb && dominated_by_p (CDI_DOMINATORS, dom_bb, gimple_bb (use_stmt))) {