new file mode 100644
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-scev-cprop" } */
+
+int a[3], d[3], c;
+int f(int e, int b)
+{
+ for (; e < 3; e++)
+ {
+ a[0] = 0;
+ if (b)
+ c = b;
+ d[e] = 0;
+ a[e] = 0;
+ }
+ return e;
+}
@@ -980,6 +980,9 @@ copy_loop_before (class loop *loop, bool redirect_lc_phi_defs)
if (TREE_CODE (USE_FROM_PTR (use_p)) == SSA_NAME)
{
tree new_def = get_current_def (USE_FROM_PTR (use_p));
+ if (!new_def)
+ /* Something defined outside of the loop. */
+ continue;
SET_USE (use_p, new_def);
}
}