https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127318

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <[email protected]>:

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

commit r17-4196-ge3457d211e2720dd0f8070fe7600be4b026ed1ef
Author: Jeff Law <[email protected]>
Date:   Sun Sep 13 08:49:47 2026 -0600

    [RISC-V][PR target/127318] Attach DEF_CFA to correct insn

    As is noted in the PR, the REG_CFA_DEF_DFA note is wrong for the testcase,
    while I get meaningfully different CFA note locations than the author, it
is
    clear that the note is getting attached to the wrong insn.

    The CFA_DEF_CFA note should get attached to the insn that copies from the
stack
    pointer into the temporary.  The RISC-V port tried to do that, but appears
to
    have just gotten the logic wrong.  The net is the CFA_DEF_CFA note got
attached
    to the insn before the stack pointer copy.  Worse yet the insn with the
note
    could move around relative to the stack pointer for scheduling purposes.

    The fix is trivial.  We just need to attach the note to the sp->temp copy.
    Given this doesn't affect code generation, but is a correctness issue, I
will
    go ahead and backport it immediately rather than waiting for the usual
simmer
    on the trunk.

    Bootstrapped and regression tested on the K3 and c920.  Also tested for the
    riscv32-elf and riscv64-elf platforms.

            PR target/127318
    gcc/
            * config/riscv/riscv.cc (riscv_v_adjust_scalable_frame): Attach
            REG_CFA_DEF_CFA note to the copy from the stack pointer.

Reply via email to