diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-26 10:25:21 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-26 10:25:21 +0000 |
commit | ae22319c67c80654007c8bb2a16e925841b4dbdb (patch) | |
tree | ae7149622fb245d57c64ae999c5287bfe155f862 /gcc/gimplify.c | |
parent | 8a83ab3e1364498dad81dee3bc5e4e92d1026073 (diff) | |
download | gcc-ae22319c67c80654007c8bb2a16e925841b4dbdb.tar.gz |
PR c++/49165
* gimplify.c (shortcut_cond_r): Don't special case
COND_EXPRs if they have void type on one of their arms.
* g++.dg/eh/cond5.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174273 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 5fd22c011c2..31e0daf3d41 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2573,7 +2573,9 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p, new_locus); append_to_statement_list (t, &expr); } - else if (TREE_CODE (pred) == COND_EXPR) + else if (TREE_CODE (pred) == COND_EXPR + && !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (pred, 1))) + && !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (pred, 2)))) { location_t new_locus; @@ -2581,7 +2583,10 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p, if (a) if (b) goto yes; else goto no; else - if (c) goto yes; else goto no; */ + if (c) goto yes; else goto no; + + Don't do this if one of the arms has void type, which can happen + in C++ when the arm is throw. */ /* Keep the original source location on the first 'if'. Set the source location of the ? on the second 'if'. */ |