public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jeff Law <law@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] Fix minor problem in stack probing
Date: Mon, 16 Oct 2023 23:17:35 +0000 (GMT)	[thread overview]
Message-ID: <20231016231735.1FBDE3858296@sourceware.org> (raw)

https://gcc.gnu.org/g:c95f0389f0d1758bd77904cfa00ab3e75e9446ba

commit c95f0389f0d1758bd77904cfa00ab3e75e9446ba
Author: Jeff Law <jlaw@ventanamicro.com>
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);

                 reply	other threads:[~2023-10-16 23:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231016231735.1FBDE3858296@sourceware.org \
    --to=law@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).