[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 gcc-bugzilla@gcc.gnu.org
Thu Jul 30 07:46:02 GMT 2026


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 <majin@gcc.gnu.org>:

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

commit r17-2809-g4e75c08f16fd97c1459320738b59068f8d003500
Author: Jin Ma <jinma@linux.alibaba.com>
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š <mjires@suse.cz>
    Signed-off-by: Jin Ma <jinma@linux.alibaba.com>


More information about the Gcc-bugs mailing list