Commit 9cb6bd74 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/69211 (g++ ICE on x86_64-linux-gnu (verify_gimple failed))

	PR c++/69211
	* cp-gimplify.c (cp_fold): If COMPOUND_EXPR or MODIFY_EXPR
	folded operands have side-effects, but folding changed any of them,
	build a new tree with the folded operands instead of returning the
	unfolded tree.

	* g++.dg/opt/pr69211.C: New test.

From-SVN: r232237
parent 5a32af0e
2016-01-11 Jakub Jelinek <jakub@redhat.com>
PR c++/69211
* cp-gimplify.c (cp_fold): If COMPOUND_EXPR or MODIFY_EXPR
folded operands have side-effects, but folding changed any of them,
build a new tree with the folded operands instead of returning the
unfolded tree.
2016-01-09 Marek Polacek <polacek@redhat.com> 2016-01-09 Marek Polacek <polacek@redhat.com>
PR c++/69113 PR c++/69113
......
...@@ -2086,7 +2086,11 @@ cp_fold (tree x) ...@@ -2086,7 +2086,11 @@ cp_fold (tree x)
if ((code == COMPOUND_EXPR || code == MODIFY_EXPR) if ((code == COMPOUND_EXPR || code == MODIFY_EXPR)
&& ((op1 && TREE_SIDE_EFFECTS (op1)) && ((op1 && TREE_SIDE_EFFECTS (op1))
|| (op0 && TREE_SIDE_EFFECTS (op0)))) || (op0 && TREE_SIDE_EFFECTS (op0))))
break; {
if (op0 != TREE_OPERAND (x, 0) || op1 != TREE_OPERAND (x, 1))
x = build2_loc (loc, code, TREE_TYPE (x), op0, op1);
break;
}
if (TREE_CODE (x) == COMPOUND_EXPR && !op0) if (TREE_CODE (x) == COMPOUND_EXPR && !op0)
op0 = build_empty_stmt (loc); op0 = build_empty_stmt (loc);
......
2016-01-11 Jakub Jelinek <jakub@redhat.com> 2016-01-11 Jakub Jelinek <jakub@redhat.com>
PR c++/69211
* g++.dg/opt/pr69211.C: New test.
PR tree-optimization/69214 PR tree-optimization/69214
* gcc.c-torture/compile/pr69214.c: New test. * gcc.c-torture/compile/pr69214.c: New test.
......
// PR c++/69211
// { dg-do compile }
int a, b;
int
foo ()
{
return (a & 5UL | (b = 4, 4L)) > 4;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment