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.
