From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46901 invoked by alias); 5 Apr 2017 09:48:43 -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 46880 invoked by uid 89); 5 Apr 2017 09:48:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Wed, 05 Apr 2017 09:48:41 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2149A326D for ; Wed, 5 Apr 2017 09:48:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C2149A326D Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C2149A326D Received: from redhat.com (ovpn-204-110.brq.redhat.com [10.40.204.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v359mcdc004117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Apr 2017 05:48:40 -0400 Date: Wed, 05 Apr 2017 09:48:00 -0000 From: Marek Polacek To: GCC Patches , Jason Merrill Subject: Re: C++ PATCH for c++/80241, ICE with alignas pack expansion Message-ID: <20170405094838.GB3172@redhat.com> References: <20170330182655.GV3172@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330182655.GV3172@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-SW-Source: 2017-04/txt/msg00206.txt.bz2 Ping. On Thu, Mar 30, 2017 at 08:26:55PM +0200, Marek Polacek wrote: > This fix is similar to c++/79653: if something went wrong during > make_pack_expansion, return error_mark instead of building up the attribute > otherwise we end up with "gnu aligned <<>>" and that would mean crashing > later on at a lot of spots. > > Also, dump_expr wasn't able to print TREE_LISTs. It's easy to do so using > dump_expr_list, so that we print '__alignof__ (A)' instead of ugly > '#'tree_list' not supported by dump_expr#'. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2017-03-30 Marek Polacek > > PR c++/80241 - ICE with alignas pack expansion. > * error.c (dump_expr): Handle TREE_LIST. > * parser.c (cp_parser_std_attribute_list): Return error_mark if > make_pack_expansion returns an error. > > * g++.dg/cpp0x/alignas11.C: New test. > > diff --git gcc/cp/error.c gcc/cp/error.c > index d8c5d5e..10af9d0 100644 > --- gcc/cp/error.c > +++ gcc/cp/error.c > @@ -2821,6 +2821,10 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) > pp_string (pp, M_("*this")); > break; > > + case TREE_LIST: > + dump_expr_list (pp, t, flags); > + break; > + > /* This list is incomplete, but should suffice for now. > It is very important that `sorry' does not call > `report_error_function'. That could cause an infinite loop. */ > diff --git gcc/cp/parser.c gcc/cp/parser.c > index c1b6496..efca2e1 100644 > --- gcc/cp/parser.c > +++ gcc/cp/parser.c > @@ -24842,8 +24842,12 @@ cp_parser_std_attribute_list (cp_parser *parser, tree attr_ns) > error_at (token->location, > "expected attribute before %<...%>"); > else > - TREE_VALUE (attribute) > - = make_pack_expansion (TREE_VALUE (attribute)); > + { > + tree pack = make_pack_expansion (TREE_VALUE (attribute)); > + if (pack == error_mark_node) > + return error_mark_node; > + TREE_VALUE (attribute) = pack; > + } > token = cp_lexer_peek_token (parser->lexer); > } > if (token->type != CPP_COMMA) > diff --git gcc/testsuite/g++.dg/cpp0x/alignas11.C gcc/testsuite/g++.dg/cpp0x/alignas11.C > index e69de29..73c54da 100644 > --- gcc/testsuite/g++.dg/cpp0x/alignas11.C > +++ gcc/testsuite/g++.dg/cpp0x/alignas11.C > @@ -0,0 +1,10 @@ > +// PR c++/80241 > +// { dg-do compile { target c++11 } } > + > +template > +struct A > +{ > + [[gnu::aligned (alignof(A))...]] char c; // { dg-error "expansion pattern" } > +}; > + > +A a; > > Marek Marek