Commit 9ca4afb9 by Richard Guenther Committed by Richard Biener

re PR c++/24439 (ICE with invert conditional containing throw)

2005-10-20  Richard Guenther  <rguenther@suse.de>

	PR c++/24439
	* fold-const.c (invert_truthvalue): Handle COND_EXPR with
	void type operands.

	* g++.dg/tree-ssa/pr24439.C: New testcase.

From-SVN: r105678
parent 2358ff91
2005-10-20 Richard Guenther <rguenther@suse.de>
PR c++/24439
* fold-const.c (invert_truthvalue): Handle COND_EXPR with
void type operands.
2005-10-20 Eric Botcazou <ebotcazou@libertysurf.fr> 2005-10-20 Eric Botcazou <ebotcazou@libertysurf.fr>
PR rtl-optimization/23585 PR rtl-optimization/23585
......
...@@ -3025,9 +3025,18 @@ invert_truthvalue (tree arg) ...@@ -3025,9 +3025,18 @@ invert_truthvalue (tree arg)
return TREE_OPERAND (arg, 0); return TREE_OPERAND (arg, 0);
case COND_EXPR: case COND_EXPR:
return build3 (COND_EXPR, type, TREE_OPERAND (arg, 0), {
invert_truthvalue (TREE_OPERAND (arg, 1)), tree arg1 = TREE_OPERAND (arg, 1);
invert_truthvalue (TREE_OPERAND (arg, 2))); tree arg2 = TREE_OPERAND (arg, 2);
/* A COND_EXPR may have a throw as one operand, which
then has void type. Just leave void operands
as they are. */
return build3 (COND_EXPR, type, TREE_OPERAND (arg, 0),
VOID_TYPE_P (TREE_TYPE (arg1))
? arg1 : invert_truthvalue (arg1),
VOID_TYPE_P (TREE_TYPE (arg2))
? arg2 : invert_truthvalue (arg2));
}
case COMPOUND_EXPR: case COMPOUND_EXPR:
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg, 0), return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg, 0),
......
2005-10-20 Richard Guenther <rguenther@suse.de>
PR c++/24439
* g++.dg/tree-ssa/pr24439.C: New testcase.
2005-10-20 Eric Botcazou <ebotcazou@libertysurf.fr> 2005-10-20 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/delay-slot-1.C: New test. * g++.dg/opt/delay-slot-1.C: New test.
/* { dg-do compile } */
/* We used to ICE in invert_truthvalue on the void type
2nd argument of the COND_EXPR. */
void foo(void)
{
int value=1;
!(value?true:throw);
}
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