[Bug target/126449] [17 Regression] ICE in gen_reg_rtx, at emit-rtl.cc:1192, mcmodel=large, since r17-2468

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.