Commit 01c7ccbb by Joseph Myers Committed by Joseph Myers

re PR c/53418 (ICE at gimplify.c:7773)

	PR c/53148
	* c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR
	from folded operands before wrapping another around the
	conditional expression.

testsuite:
	* gcc.c-torture/compile/pr53418-1.c,
	gcc.c-torture/compile/pr53418-2.c: New tests.

From-SVN: r187718
parent 7772bae0
2012-05-21 Joseph Myers <joseph@codesourcery.com>
PR c/53148
* c-typeck.c (build_conditional_expr): Remove C_MAYBE_CONST_EXPR
from folded operands before wrapping another around the
conditional expression.
2012-05-21 Jakub Jelinek <jakub@redhat.com> 2012-05-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/53366 PR tree-optimization/53366
......
...@@ -4408,6 +4408,11 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, ...@@ -4408,6 +4408,11 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
ret = fold_build3_loc (colon_loc, COND_EXPR, result_type, ifexp, op1, op2); ret = fold_build3_loc (colon_loc, COND_EXPR, result_type, ifexp, op1, op2);
else else
{ {
if (int_operands)
{
op1 = remove_c_maybe_const_expr (op1);
op2 = remove_c_maybe_const_expr (op2);
}
ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); ret = build3 (COND_EXPR, result_type, ifexp, op1, op2);
if (int_operands) if (int_operands)
ret = note_integer_operands (ret); ret = note_integer_operands (ret);
......
2012-05-21 Joseph Myers <joseph@codesourcery.com>
PR c/53148
* gcc.c-torture/compile/pr53418-1.c,
gcc.c-torture/compile/pr53418-2.c: New tests.
2012-05-21 Jakub Jelinek <jakub@redhat.com> 2012-05-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/53366 PR tree-optimization/53366
......
void
f (void)
{
int i = (0 ? 1 : 0U / 0);
}
void
f (void)
{
int i = (1 ? 0U / 0 : 1);
}
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