From patchwork Tue Apr 12 23:36:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 90885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E92E8B6F3A for ; Wed, 13 Apr 2011 09:36:50 +1000 (EST) Received: (qmail 12906 invoked by alias); 12 Apr 2011 23:36:49 -0000 Received: (qmail 12898 invoked by uid 22791); 12 Apr 2011 23:36:49 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, TW_TM, T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 23:36:43 +0000 Received: from eggs.gnu.org ([140.186.70.92]:38776) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Q9n8T-0002Xw-By for gcc-patches@gnu.org; Tue, 12 Apr 2011 19:36:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9n8S-0000vR-0a for gcc-patches@gnu.org; Tue, 12 Apr 2011 19:36:40 -0400 Received: from qmta07.westchester.pa.mail.comcast.net ([76.96.62.64]:43014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9n8R-0000tj-Oq for gcc-patches@gnu.org; Tue, 12 Apr 2011 19:36:39 -0400 Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta07.westchester.pa.mail.comcast.net with comcast id WnKE1g0060cZkys57ncfW9; Tue, 12 Apr 2011 23:36:39 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta10.westchester.pa.mail.comcast.net with comcast id Wncd1g00e0BKwT43WnceKR; Tue, 12 Apr 2011 23:36:39 +0000 From: Mike Stump Subject: Fix 20020425-1.c Date: Tue, 12 Apr 2011 16:36:35 -0700 Message-Id: To: gcc-patches@gnu.org Mime-Version: 1.0 (Apple Message framework v1084) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 76.96.62.64 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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 * 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 %"); } - 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); }