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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Ma Jin <[email protected]>:

https://gcc.gnu.org/g:4e75c08f16fd97c1459320738b59068f8d003500

commit r17-2809-g4e75c08f16fd97c1459320738b59068f8d003500
Author: Jin Ma <[email protected]>
Date:   Tue Jul 28 19:58:16 2026 +0800

    RISC-V: Fix sibcall address legalization in MI thunks [PR126449]

    MI thunks generate RTL as if reload were complete and emit it directly
    without running register allocation.  Creating a pseudo while
    materializing an invalid sibcall address therefore triggers the
    gen_reg_rtx assertion.

    Use STATIC_CHAIN_REGNUM for this post-reload thunk path.  It is available
    as a temporary in MI thunks and belongs to SIBCALL_REGS.  Keep using a
    pseudo for sibcalls expanded before register allocation.

            PR target/126449

    gcc/ChangeLog:

            * config/riscv/riscv.cc (riscv_legitimize_call_address): Use
            STATIC_CHAIN_REGNUM when a sibcall address is materialized in
            post-reload thunk code.

    gcc/testsuite/ChangeLog:

            * g++.target/riscv/pr126449.C: New test.

    Reported-by: Michal JireÅ¡ <[email protected]>
    Signed-off-by: Jin Ma <[email protected]>

Reply via email to