[Bug target/126434] [17 Regression] ICE: invalid rtl sharing found in the insn {zero_extendsidi2} since r17-1375

"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=126434

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

https://gcc.gnu.org/g:91663770f795fd02688c1da004337a1e7c94e810

commit r17-2790-g91663770f795fd02688c1da004337a1e7c94e810
Author: Konstantinos Eleftheriou <[email protected]>
Date:   Tue Jul 28 11:27:38 2026 +0200

    avoid-store-forwarding: Unshare load dest when re-applying extension
[PR126434]

    When store forwarding is avoided without eliminating the load (the store
    only partially covers it), the extension wrapping the load's MEM is
    re-applied after the bit-insert sequence, reusing SET_DEST (load) as the
    move destination. As the load insn is kept here, that rtx is now shared
    between two insns. That is fine for a plain REG, but in the case that the
    dest is a SUBREG, it must not be shared (verify_rtx_sharing ICEs).

    Unshare the destination with copy_rtx when building the move.

    Bootstrapped/regtested on AArch64, x86-64 and PowerPC.

            PR rtl-optimization/126434

    gcc/ChangeLog:

            * avoid-store-forwarding.cc (process_store_forwarding): Unshare the
            load destination when building the re-extension move.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr126434.c: New test.
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.