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);
 }
 
