------- Comment #5 from jakub at gcc dot gnu dot org 2007-07-10 13:10 ------- This got fixed by http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00206.html on the trunk. Even is subset of those changes fixes this on 4.2 branch: --- gcc/tree-ssa-ccp.c.jj 2007-03-20 00:22:09.000000000 +0100 +++ gcc/tree-ssa-ccp.c 2007-07-10 14:49:15.000000000 +0200 @@ -2063,12 +2063,13 @@ fold_stmt_r (tree *expr_p, int *walk_sub tem = fold_binary (TREE_CODE (op0), TREE_TYPE (op0), TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); - set = tem && is_gimple_condexpr (tem); + set = tem && set_rhs (expr_p, tem); fold_undefer_overflow_warnings (set, fold_stmt_r_data->stmt, 0); if (set) - TREE_OPERAND (expr, 0) = tem; - t = expr; - break; + { + t = *expr_p; + break; + } }
default: --- gcc/tree-ssa-propagate.c.jj 2007-03-20 00:22:09.000000000 +0100 +++ gcc/tree-ssa-propagate.c 2007-07-10 14:55:18.000000000 +0200 @@ -571,7 +571,8 @@ set_rhs (tree *stmt_p, tree expr) ssa_op_iter iter; /* Verify the constant folded result is valid gimple. */ - if (TREE_CODE_CLASS (code) == tcc_binary) + if (TREE_CODE_CLASS (code) == tcc_binary + || TREE_CODE_CLASS (code) == tcc_comparison) { if (!is_gimple_val (TREE_OPERAND (expr, 0)) || !is_gimple_val (TREE_OPERAND (expr, 1))) which prevents in this case generating invalid gimple. On gcc-4_1-branch, even just the tree-ssa-propagate.c chunk cures this. Is this something which can safely be changed on the release branches? -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dnovillo at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32694