From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90697 invoked by alias); 25 Mar 2015 13:46:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 90675 invoked by uid 89); 25 Mar 2015 13:46:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 25 Mar 2015 13:46:50 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 91C0428E401 for ; Wed, 25 Mar 2015 13:46:48 +0000 (UTC) Received: from redhat.com (ovpn-204-20.brq.redhat.com [10.40.204.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2PDki9p014359 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Wed, 25 Mar 2015 09:46:47 -0400 Date: Wed, 25 Mar 2015 13:46:00 -0000 From: Marek Polacek To: GCC Patches , Jason Merrill Subject: C++ PATCH for c++/61670 (ice-after-error with null DECL_SIZE) Message-ID: <20150325134644.GW31197@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-03/txt/msg01301.txt.bz2 The following fixes an ICE on invalid code by checking that DECL_SIZE is not null before feeding it to integer_zerop. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-25 Marek Polacek PR c++/61670 * class.c (remove_zero_width_bit_fields): Check for null DECL_SIZE. * g++.dg/template/pr61670.C: New test. diff --git gcc/cp/class.c gcc/cp/class.c index 0518320..c2d4201 100644 --- gcc/cp/class.c +++ gcc/cp/class.c @@ -5434,7 +5434,8 @@ remove_zero_width_bit_fields (tree t) DECL_INITIAL (*fieldsp). check_bitfield_decl eventually sets DECL_SIZE (*fieldsp) to that width. */ - && integer_zerop (DECL_SIZE (*fieldsp))) + && (DECL_SIZE (*fieldsp) == NULL_TREE + || integer_zerop (DECL_SIZE (*fieldsp)))) *fieldsp = DECL_CHAIN (*fieldsp); else fieldsp = &DECL_CHAIN (*fieldsp); diff --git gcc/testsuite/g++.dg/template/pr61670.C gcc/testsuite/g++.dg/template/pr61670.C index e69de29..d244efa 100644 --- gcc/testsuite/g++.dg/template/pr61670.C +++ gcc/testsuite/g++.dg/template/pr61670.C @@ -0,0 +1,9 @@ +// PR c++/61670 +// { dg-do compile } + +template +class A { + A: 0 // { dg-error "" } +}; + +A a; Marek