expr.c (expand_expr): Cope with COND_EXPRs with one non-returning branch.
authorNathan Sidwell <nathan@acm.org>
Tue, 24 Aug 1999 20:49:12 +0000 (20:49 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 24 Aug 1999 20:49:12 +0000 (16:49 -0400)
* expr.c (expand_expr): Cope with COND_EXPRs with one
non-returning branch.

From-SVN: r28825

gcc/ChangeLog
gcc/expr.c

index 4681f69447e56898a5c411040bb38bc70fdf679d..b107d30a121c45113e385307474a7a6e5ce8f2cf 100644 (file)
@@ -1,3 +1,8 @@
+Tue Aug 24 13:48:39 1999  Nathan Sidwell  <nathan@acm.org>
+
+       * expr.c (expand_expr): Cope with COND_EXPRs with one
+       non-returning branch.
+       
 Mon Aug 23 22:28:16 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * expr.c (store_expr): Always pass down the target, even when not
index 7783bf97b80352fb10f60d053cf093a23b2c03ea..97bf5a9fa00b9f94e7d5411593c43bbc9569358a 100644 (file)
@@ -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),