From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 1FBDE3858296; Mon, 16 Oct 2023 23:17:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FBDE3858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697498255; bh=6+Y1XIO39x0KlY5WPhiAAygtOn3jRh2773kVC/wZFBw=; h=From:To:Subject:Date:From; b=Nm6HT1lX2nkwvHzp5W/HA7ep4mY2/PeZMyVej9FI86wAUyDqFpgi2Apcw2vCPdQWd tj+t5WiTN2G/CLdTmspZbNn15ACHz3CDPHpL8qZ63xoisBWKBmvbmIcxR+BbsCRcFh ayTPEUxwuv1ITksYL+wIpq9pGKVXGRPngJlTxF0U= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] Fix minor problem in stack probing X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/vendors/riscv/heads/gcc-13-with-riscv-opts X-Git-Oldrev: 7ed0ac15f36dbb02b7a08bfbfa53012d758c1194 X-Git-Newrev: c95f0389f0d1758bd77904cfa00ab3e75e9446ba Message-Id: <20231016231735.1FBDE3858296@sourceware.org> Date: Mon, 16 Oct 2023 23:17:35 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c95f0389f0d1758bd77904cfa00ab3e75e9446ba commit c95f0389f0d1758bd77904cfa00ab3e75e9446ba Author: Jeff Law Date: Mon Oct 16 17:14:38 2023 -0600 Fix minor problem in stack probing probe_stack_range has an assert to capture the possibility that that expand_binop might not construct its result in the provided target. We triggered that internally a little while ago. I'm pretty sure it was in the testsuite, so no new testcase. The fix is easy, copy the result into the proper target when needed. Bootstrapped and regression tested on x86. gcc/ * explow.cc (probe_stack_range): Handle case when expand_binop does not construct its result in the expected location. (cherry picked from commit b626751a4e87b090531c648631df33ac20c4fab8) Diff: --- gcc/explow.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/explow.cc b/gcc/explow.cc index 6424c0802f07..0c03ac350bbe 100644 --- a/gcc/explow.cc +++ b/gcc/explow.cc @@ -1818,7 +1818,10 @@ probe_stack_range (HOST_WIDE_INT first, rtx size) gen_int_mode (PROBE_INTERVAL, Pmode), test_addr, 1, OPTAB_WIDEN); - gcc_assert (temp == test_addr); + /* There is no guarantee that expand_binop constructs its result + in TEST_ADDR. So copy into TEST_ADDR if necessary. */ + if (temp != test_addr) + emit_move_insn (test_addr, temp); /* Probe at TEST_ADDR. */ emit_stack_probe (test_addr);