diff options
author | Richard Guenther <rguenther@suse.de> | 2005-10-20 15:19:03 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-10-20 15:19:03 +0000 |
commit | 9ca4afb947aa1edc2da5d4d8f809f92eb5b7149c (patch) | |
tree | a54c3badb757d1310e8ac6ecfbb2e2f11d6caaf3 /gcc/fold-const.c | |
parent | 2358ff9116d8167e4b0d2f70a9d61e4e8ca5168e (diff) | |
download | gcc-9ca4afb947aa1edc2da5d4d8f809f92eb5b7149c.tar.gz |
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a6aa1df818c..16e7eb30b30 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3025,9 +3025,18 @@ invert_truthvalue (tree arg) return TREE_OPERAND (arg, 0); case COND_EXPR: - return build3 (COND_EXPR, type, TREE_OPERAND (arg, 0), - invert_truthvalue (TREE_OPERAND (arg, 1)), - invert_truthvalue (TREE_OPERAND (arg, 2))); + { + tree arg1 = TREE_OPERAND (arg, 1); + 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: return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg, 0), |