From patchwork Tue Jun 11 16:27:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 250573 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 213442C02FA for ; Wed, 12 Jun 2013 02:27:36 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:subject:date:message-id:cc:to:mime-version; q=dns; s=default; b=Wp3r6o+SCXX0NU5YAPR/I7r50cb4UwU0hDwTZ9isFnQCgQiK34 ia1XEKcz8ACKBJ+V7KkAGj4NeqKmgvQT05Kzs3LOppZ2bTlpkjCHXDUctHTSfX+j UzuaNs8MODAqZBcL2hTA8hBx/7PkoSUyfAEGnwhk0aWiyCfng6AgtaB2Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:subject:date:message-id:cc:to:mime-version; s= default; bh=06nhdHeF6lIBIMRxP6xiLw1Z+iI=; b=nLyRIoZlYraVhFziQXxn 0nz+fAKr98ab0Q73DGDXfBRZ7wLv+sIC44g3Xu390/xEO4Xte1vFVpPkytOG6HzU hmlT3Vu8Kqu5/DxLLfrkqrlyyUPnnN18zOWBhf5v9CDodEnPFVAGfb1WKf7ZVsgF uFKoiFgmK7KTha6yL0vRsFo= Received: (qmail 32505 invoked by alias); 11 Jun 2013 16:27:29 -0000 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 Received: (qmail 32496 invoked by uid 89); 11 Jun 2013 16:27:29 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from qmta14.emeryville.ca.mail.comcast.net (HELO qmta14.emeryville.ca.mail.comcast.net) (76.96.27.212) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 11 Jun 2013 16:27:28 +0000 Received: from omta21.emeryville.ca.mail.comcast.net ([76.96.30.88]) by qmta14.emeryville.ca.mail.comcast.net with comcast id n4Cq1l0051u4NiLAE4TTWN; Tue, 11 Jun 2013 16:27:27 +0000 Received: from bag6-1-pt.tunnel.tserv3.fmt2.ipv6.he.net ([IPv6:2001:470:1f04:ae1::2]) by omta21.emeryville.ca.mail.comcast.net with comcast id n4TS1l0010P3DwE8h4TThT; Tue, 11 Jun 2013 16:27:27 +0000 From: Mike Stump Subject: C++: fix ICE with CONST_DECLs Date: Tue, 11 Jun 2013 09:27:25 -0700 Message-Id: Cc: Jason Merrill To: gcc-patches patches Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) X-Virus-Found: No Here is a simple one. When processing CONST_DECLs after an error, we can ICE. This avoid the ICE. Ok? 2013-06-11 Mike Stump * init.c (constant_value_1): Protect CONST_DECLs better in the face of errors. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 44e558e..133a162 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1988,7 +1988,7 @@ constant_value_1 (tree decl, bool integral_p, bool return_aggregate_cst_ok_p) init = DECL_INITIAL (decl); if (init == error_mark_node) { - if (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) + if (VAR_P (decl) && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) /* Treat the error as a constant to avoid cascading errors on excessively recursive template instantiation (c++/9335). */ return init;