]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix minor problem in stack probing
authorJeff Law <jlaw@ventanamicro.com>
Mon, 16 Oct 2023 23:14:38 +0000 (17:14 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 16 Oct 2023 23:16:12 +0000 (17:16 -0600)
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.

gcc/explow.cc

index 6424c0802f07f05a2e6513044b92a02394488796..0c03ac350bbe2261b32d820b57313bf19b340f47 100644 (file)
@@ -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);