From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id C9FEA385380D; Thu, 5 May 2022 12:04:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9FEA385380D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] vrp: Fix ICE for pointer cap<->noncap casts X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 2f0e6bc008a27e3222072bc791e4325b845789be X-Git-Newrev: 7b533cd785ed59adb3bdd5d49a0b3fcb43624301 Message-Id: <20220505120449.C9FEA385380D@sourceware.org> Date: Thu, 5 May 2022 12:04:49 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:04:49 -0000 https://gcc.gnu.org/g:7b533cd785ed59adb3bdd5d49a0b3fcb43624301 commit 7b533cd785ed59adb3bdd5d49a0b3fcb43624301 Author: Richard Sandiford Date: Mon Mar 14 18:10:58 2022 +0000 vrp: Fix ICE for pointer cap<->noncap casts vrp_insert::find_assert_locations_in_bb has code to register assertions for operands of a statement, which we protected against capabilities. However, it also has code to register assertions for the sources of conversions, and those need to be protected against capabilities too. Diff: --- gcc/tree-vrp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 0a5ab8c579b..19bf6acc7ef 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2926,8 +2926,6 @@ vrp_insert::find_assert_locations_in_bb (basic_block bb) /* See if we can derive an assertion for any of STMT's operands. */ FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_USE) { - if (capability_type_p (TREE_TYPE (op))) - continue; tree value; enum tree_code comp_code; @@ -2966,13 +2964,16 @@ vrp_insert::find_assert_locations_in_bb (basic_block bb) /* Note we want to register the assert for the operand of the NOP_EXPR after SI, not after the conversion. */ - if (live.live_on_block_p (t, bb)) + if (live.live_on_block_p (t, bb) + && !capability_type_p (TREE_TYPE (t))) register_new_assert_for (t, t, comp_code, value, bb, NULL, si); } } - register_new_assert_for (op, op, comp_code, value, bb, NULL, si); + if (!capability_type_p (TREE_TYPE (op))) + register_new_assert_for (op, op, comp_code, value, + bb, NULL, si); } }