aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>1999-08-24 20:49:12 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-08-24 16:49:12 -0400
commit2ac84cfe01bfb92a83f18263740435f696321e32 (patch)
treedaa01fc0f611dbb0f5dbc26dadf1e8aa3145eecb /gcc/expr.c
parent1da93fe012a0f34e4c50f3ccc98bd8a21ab396d3 (diff)
downloadgcc-2ac84cfe01bfb92a83f18263740435f696321e32.zip
gcc-2ac84cfe01bfb92a83f18263740435f696321e32.tar.gz
gcc-2ac84cfe01bfb92a83f18263740435f696321e32.tar.bz2
expr.c (expand_expr): Cope with COND_EXPRs with one non-returning branch.
* expr.c (expand_expr): Cope with COND_EXPRs with one non-returning branch. From-SVN: r28825
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 7783bf9..97bf5a9 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7700,7 +7700,11 @@ expand_expr (exp, target, tmode, modifier)
jumpifnot (TREE_OPERAND (exp, 0), op0);
start_cleanup_deferral ();
- if (temp != 0)
+
+ /* One branch of the cond can be void, if it never returns. For
+ example A ? throw : E */
+ if (temp != 0
+ && TREE_TYPE (TREE_OPERAND (exp, 1)) != void_type_node)
store_expr (TREE_OPERAND (exp, 1), temp, 0);
else
expand_expr (TREE_OPERAND (exp, 1),
@@ -7711,7 +7715,8 @@ expand_expr (exp, target, tmode, modifier)
emit_barrier ();
emit_label (op0);
start_cleanup_deferral ();
- if (temp != 0)
+ if (temp != 0
+ && TREE_TYPE (TREE_OPERAND (exp, 2)) != void_type_node)
store_expr (TREE_OPERAND (exp, 2), temp, 0);
else
expand_expr (TREE_OPERAND (exp, 2),