https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124476
--- Comment #4 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:a48fbdd6a803429ccf2eda7c9ba8ecdd975f8e35 commit r16-8135-ga48fbdd6a803429ccf2eda7c9ba8ecdd975f8e35 Author: Philipp Tomsich <[email protected]> Date: Fri Mar 13 11:01:45 2026 +0100 avoid-store-forwarding: Reject overlapping stores [PR124476] The redundant-store tracking introduced in ec5349c37af replaced a safe bitmap_bit_in_range_p check (which bailed on any overlap) with bitmap_all_bits_in_range_p (which only removed fully redundant stores). This broke "last writer wins" semantics for partially overlapping stores: when an earlier store's BFI was applied after the base store's value, it overwrote bytes that should have belonged to the later store. Restore the original overlap check from 1d8de1e93ea: bail out of the optimization when any bit in a store's byte range is already claimed by a later store in program order. Remove the now-unnecessary redundant-store tracking (redundant_stores, store_ind_to_remove). gcc/ChangeLog: PR rtl-optimization/124476 * avoid-store-forwarding.cc (store_forwarding_analyzer::process_store_forwarding): Replace bitmap_all_bits_in_range_p with bitmap_any_bit_in_range_p and return false on partial overlap. Remove redundant-store vectors and their associated removal, dump, and deletion logic. gcc/testsuite/ChangeLog: PR rtl-optimization/124476 * gcc.dg/pr124476.c: New test.
