Hi! When stmt is mem = {v} {CLOBBER};, then lhs is neither SSA_NAME, but it doesn't satisfy gimple_assign_copy_p either. With this patch it will set the new_tree also to the clobber, making it clear that the next iteration uses unitialized variable.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-11-24 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/51246 * tree-predcom.c (replace_ref_with): Allow also clobber on the rhs. * gcc.c-torture/compile/pr51246.c: New test. --- gcc/tree-predcom.c.jj 2011-09-26 14:07:06.000000000 +0200 +++ gcc/tree-predcom.c 2011-11-24 09:17:46.872962765 +0100 @@ -1306,8 +1306,10 @@ replace_ref_with (gimple stmt, tree new_ val = gimple_assign_lhs (stmt); if (TREE_CODE (val) != SSA_NAME) { - gcc_assert (gimple_assign_copy_p (stmt)); val = gimple_assign_rhs1 (stmt); + gcc_assert (gimple_assign_single_p (stmt) + && (gimple_assign_copy_p (stmt) + || TREE_CLOBBER_P (val))); } } else --- gcc/testsuite/gcc.c-torture/compile/pr51246.c.jj 2011-11-24 09:15:10.322906812 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr51246.c 2011-11-24 09:14:52.000000000 +0100 @@ -0,0 +1,14 @@ +/* PR tree-optimization/51246 */ + +int a, *b; + +void +test (void) +{ + while (1) + { + int c; + a = c; + b = &c; + } +} Jakub