https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104910
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:c9b590a80fbe16a118acdbab15e6f82853db6806 commit r10-10695-gc9b590a80fbe16a118acdbab15e6f82853db6806 Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Mar 16 11:04:16 2022 +0100 aarch64: Fix up RTL sharing bug in aarch64_load_symref_appropriately [PR104910] We unshare all RTL created during expansion, but when aarch64_load_symref_appropriately is called after expansion like in the following testcases, we use imm in both HIGH and LO_SUM operands. If imm is some RTL that shouldn't be shared like a non-sharable CONST, we get at least with --enable-checking=rtl a checking ICE, otherwise might just get silently wrong code. The following patch fixes that by copying it if it can't be shared. 2022-03-16 Jakub Jelinek <ja...@redhat.com> PR target/104910 * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Copy imm rtx. * gcc.dg/pr104910.c: New test. (cherry picked from commit 952155629ca1a4dfe7c7b26e53d118a9b853ed4a)