https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117872
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Philipp Tomsich <ptoms...@gcc.gnu.org>: https://gcc.gnu.org/g:c86e1c54c6f8771d08a8c070717b80607f990f8a commit r15-6464-gc86e1c54c6f8771d08a8c070717b80607f990f8a Author: kelefth <konstantinos.elefther...@vrull.eu> Date: Mon Dec 16 14:36:59 2024 +0100 avoid-store-forwarding: fix reg init on load-eliminiation [PR117835] During the initialization of the base register for the zero-offset store, in the case that we are eliminating the load, we used a paradoxical subreg assuming that we don't care about the higher bits of the register. This led to writing wrong values when we were not updating the whole register. This patch fixes the issue by zero-extending the value stored in the base register instead of using a paradoxical subreg. Bootstrapped/regtested on x86 and AArch64. PR rtl-optimization/117835 PR rtl-optimization/117872 gcc/ChangeLog: * avoid-store-forwarding.cc (store_forwarding_analyzer::process_store_forwarding): Zero-extend the value stored in the base register instead of using a paradoxical subreg. gcc/testsuite/ChangeLog: * gcc.target/i386/pr117835.c: New test.