https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111497
--- Comment #10 from GCC 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:959cef942508b818c7dcb8df0f3c7bf4968d406a commit r12-10554-g959cef942508b818c7dcb8df0f3c7bf4968d406a Author: Vladimir N. Makarov <vmaka...@redhat.com> Date: Mon Sep 25 16:19:50 2023 -0400 [PR111497][LRA]: Copy substituted equivalence When we substitute the equivalence and it becomes shared, we can fail to correctly update reg info used by LRA. This can result in wrong code generation, e.g. because of incorrect live analysis. It can also result in compiler crash as the pseudo survives RA. This is what exactly happened for the PR. This patch solves this problem by unsharing substituted equivalences. gcc/ChangeLog: PR middle-end/111497 * lra-constraints.cc (lra_constraints): Copy substituted equivalence. * lra.cc (lra): Change comment for calling unshare_all_rtl_again. gcc/testsuite/ChangeLog: PR middle-end/111497 * g++.target/i386/pr111497.C: new test. (cherry picked from commit 3c23defed384cf17518ad6c817d94463a445d21b)