This fixes 20020425-1.c when the compiler under test is built with -O0 and we're on a machine with an 8 meg stack.
Ok? 2011-04-12 Mike Stump <mikest...@comcast.net> * c-typeck.c (c_finish_if_stmt): Fold result. * fold-const.c (fold_ternary_loc): Handle an empty else.
This fixes 20020425-1.c so that it doesn't fail when the compiler is built with -O0. 2011-04-12 Mike Stump <mikest...@comcast.net> * c-typeck.c (c_finish_if_stmt): Fold result. * fold-const.c (fold_ternary_loc): Handle an empty else. Index: fold-const.c =================================================================== --- fold-const.c (revision 1279) +++ fold-const.c (working copy) @@ -13260,6 +13260,8 @@ return NULL_TREE; case COND_EXPR: + if (!op2) + return NULL_TREE; /* Pedantic ANSI C says that a conditional expression is never an lvalue, so all simple results must be passed through pedantic_non_lvalue. */ if (TREE_CODE (arg0) == INTEGER_CST) Index: c-typeck.c =================================================================== --- c-typeck.c (revision 1279) +++ c-typeck.c (working copy) @@ -8916,8 +8916,7 @@ "suggest explicit braces to avoid ambiguous %<else%>"); } - stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block); - SET_EXPR_LOCATION (stmt, if_locus); + stmt = fold_build3_loc (if_locus, COND_EXPR, void_type_node, cond, then_block, else_block); add_stmt (stmt); }