===================================================================
@@ -257,13 +257,11 @@ propagate_tree_value_into_stmt (gimple_s
else if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE)
{
- gimple new_stmt;
-
tree expr = NULL_TREE;
+ bool res;
propagate_tree_value (&expr, val);
- new_stmt = gimple_build_assign (gimple_call_lhs (stmt), expr);
- move_ssa_defining_stmt_for_defs (new_stmt, stmt);
- gsi_replace (gsi, new_stmt, false);
+ res = update_call_from_tree (gsi, expr);
+ gcc_assert (res);
}
else if (gimple_code (stmt) == GIMPLE_SWITCH)
propagate_tree_value (gimple_switch_index_ptr (stmt), val);
===================================================================
@@ -0,0 +1,29 @@
+// { dg-do compile }
+
+int g, *gp[100];
+struct V {
+ int* x;
+ int y;
+};
+
+void foo (V **p, V* end, int i)
+{
+ *p = 0;
+ V* pp = *p;
+ int s = 100;
+ for (; pp < end; )
+ {
+ pp++;
+ (pp-1)->x = &g;
+ if (g)
+ {
+ if (g>10)
+ g++;
+ int *t = (int*) operator new (100);
+ (pp-1)->x = t;
+ }
+ else
+ s--;
+ gp[end-pp] = (pp-1)->x + s;
+ }
+}