From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 9DBD73858D33; Mon, 16 Oct 2023 23:16:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DBD73858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697498187; bh=q7bI26yDL3OXhmn1kFVPBvGhBjKibF80bT3ohESLpMw=; h=From:To:Subject:Date:From; b=Nmw8NiBh/+IXPlI3Z2kGzJOsbubtjuFWckSrx7RWb2AzCGm1XkMpWcZVaczDx03Wn TXOobGeALnX8DyQGfU7XIeWMsnvfR2VztVE7QGKL8GhIAxZmnCpB57Y4qP1rarieDH m5xod3Xe7nJKCmL7pB26BRq/KyrsLUu2moD4NbPA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4670] Fix minor problem in stack probing X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 04013e4464020b4440aa41524a222658d7e36937 X-Git-Newrev: b626751a4e87b090531c648631df33ac20c4fab8 Message-Id: <20231016231627.9DBD73858D33@sourceware.org> Date: Mon, 16 Oct 2023 23:16:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b626751a4e87b090531c648631df33ac20c4fab8 commit r14-4670-gb626751a4e87b090531c648631df33ac20c4fab8 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. 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);