On 7/16/25 7:04 AM, Andreas Schwab wrote:
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 1275b034cf8..26ef67dd1cb 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -9049,7 +9049,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;
}
It looks like temp1 is uninitialized on that path, so we'd get whatever
value happened to be lying in that temporary register, right?
It looks like the computation you're doing with temp2 instead ultimately
computes sp + initial_cfa_offset after eliminating the offsetting
rounded_size terms, right?
Not asking for any changes, just want to make sure I'm understanding the
flow correctly.
Jeff