https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126434
--- Comment #6 from Konstantinos Eleftheriou <konstantinos.eleftheriou at vrull dot eu> --- (In reply to Jakub Jelinek from comment #3) > --- gcc/avoid-store-forwarding.cc.jj 2026-06-05 20:39:09.411516351 +0200 > +++ gcc/avoid-store-forwarding.cc 2026-07-28 11:50:15.835271670 +0200 > @@ -444,7 +444,7 @@ process_store_forwarding (vec<store_fwd_ > else > move_src = dest; > > - rtx move = gen_rtx_SET (SET_DEST (load), move_src); > + rtx move = gen_rtx_SET (copy_rtx (SET_DEST (load)), move_src); > > start_sequence (); > rtx_insn *insn = emit_insn (move); > > fixes this exact case, but wonder how many other RTX sharing bugs are in the > pass. > E.g. dest = SET_DEST (load); and tons of uses of dest in various new insns, > etc. Currently there are not any other sharing concerns that I can see, purely by luck though. `dest = SET_DEST (load);` passes through `store_bit_field`, which uses `unshare_all_rtl_in_chain`. The other instances reuse RTX from stores that are getting deleted. We could use `copy_rtx` for those instances too, just for hardening.
