https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107107
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:ff0a274e5c3026b105c7f51126fa51f8178fa42c commit r12-8838-gff0a274e5c3026b105c7f51126fa51f8178fa42c Author: Richard Biener <rguent...@suse.de> Date: Thu Oct 6 11:20:16 2022 +0200 tree-optimization/107107 - tail-merging VN wrong-code The following fixes an unintended(?) side-effect of the special MODIFY_EXPR expression entries we add for tail-merging during VN. We shouldn't value-number the virtual operand differently here. PR tree-optimization/107107 * tree-ssa-sccvn.cc (visit_reference_op_store): Do not affect value-numbering when doing the tail merging MODIFY_EXPR lookup. * gcc.dg/pr107107.c: New testcase. (cherry picked from commit 85333b9265720fc4e49397301cb16324d2b89aa7)