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

commit r15-10170-gc70696b3daaaa45043be5cd7219e15894bc32e50
Author: Andreas Schwab <sch...@suse.de>
Date:   Wed Jul 16 14:48:51 2025 +0200

    [RISC-V] Fix wrong CFA during stack probe
    
    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.
    
    (cherry picked from commit b441d735c092f5d60c4a9c7167ed9153003d49fa)

Diff:
---
 gcc/config/riscv/riscv.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 962bfe3aea50..bd0046ad2e8f 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -8698,7 +8698,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;
        }

Reply via email to