]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RISC-V] Fix wrong CFA during stack probe
authorAndreas Schwab <schwab@suse.de>
Wed, 16 Jul 2025 12:48:51 +0000 (14:48 +0200)
committerAndreas Schwab <schwab@suse.de>
Mon, 21 Jul 2025 13:27:36 +0000 (15:27 +0200)
temp1 is used by the probe loop for the step size, but we need the final
address of the stack after the loop which resides in temp2.

PR target/121121
* config/riscv/riscv.cc (riscv_allocate_and_probe_stack_space):
Use temp2 instead of temp1 for the CFA note.

gcc/config/riscv/riscv.cc

index 6e630695b61202fdf500a2f79ebe90fbb1b40a74..3324819864a053fba44ad688d14e429dc4974928 100644 (file)
@@ -9077,7 +9077,7 @@ riscv_allocate_and_probe_stack_space (rtx temp1, HOST_WIDE_INT size)
          /* We want the CFA independent of the stack pointer for the
             duration of the loop.  */
          add_reg_note (insn, REG_CFA_DEF_CFA,
-                       plus_constant (Pmode, temp1,
+                       plus_constant (Pmode, temp2,
                                       initial_cfa_offset + rounded_size));
          RTX_FRAME_RELATED_P (insn) = 1;
        }