The following fixes a missing add to the accumulated offset when
adjusting an ARRAY_REF op for value-ranges applied to by
get_ref_base_and_extent.
PR tree-optimization/113898
* tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Add
missing accumulated off adjustment.
* gcc.dg/torture/pr113898.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+
+int a, d;
+unsigned **b;
+long c, f;
+long e[2][1];
+void g() {
+ int h = 0;
+ for (; h < 2; h++) {
+ e[h][d + **b + a] = c;
+ if (f)
+ for (;;)
+ ;
+ }
+}
+void main() {}
op.op0 = wide_int_to_tree (TREE_TYPE (op.op0),
wi::to_poly_wide (op.op1) + idx);
op.off = idx * elsz;
+ off += op.off;
}
else
{