https://gcc.gnu.org/g:6d9c1aad2c46092ac0e5adcaad2ea5af57fad180

commit r16-3155-g6d9c1aad2c46092ac0e5adcaad2ea5af57fad180
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Aug 11 14:43:58 2025 +0200

    Restrict aggregate copy VN generalization
    
    The following avoids ending up with a MEM_REF as component to apply.
    
            * tree-ssa-sccvn.cc (vn_reference_lookup_3): When we fail to
            match up the two base MEM_REFs, fail.

Diff:
---
 gcc/tree-ssa-sccvn.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 61d794d84072..cdd7c0542add 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3631,7 +3631,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void 
*data_,
            {
              extra_off = vr->operands[i].off - lhs_ops[j].off;
              i--, j--;
+             found = true;
            }
+         /* If we did find a match we'd eventually append a MEM_REF
+            as component.  Don't.  */
+         if (!found)
+           return (void *)-1;
        }
       else
        return (void *)-1;

Reply via email to