From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80164 invoked by alias); 14 Jun 2018 16:51:12 -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 80154 invoked by uid 89); 14 Jun 2018 16:51:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=marek, Polacek, Marek, polacek X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jun 2018 16:51:11 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 804C14023461 for ; Thu, 14 Jun 2018 16:51:09 +0000 (UTC) Received: from redhat.com (ovpn-125-213.rdu2.redhat.com [10.10.125.213]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C71C1C4E7; Thu, 14 Jun 2018 16:51:09 +0000 (UTC) Date: Thu, 14 Jun 2018 16:51:00 -0000 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: C++ PATCH for c++/86063, ICE with attribute with pack expansion Message-ID: <20180614165107.GG17989@redhat.com> References: <20180606211835.GC28085@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-SW-Source: 2018-06/txt/msg00858.txt.bz2 On Mon, Jun 11, 2018 at 03:00:04PM -0400, Jason Merrill wrote: > On Wed, Jun 6, 2018 at 5:18 PM, Marek Polacek wrote: > > We crash on this testcase containing a bogus attribute, because > > cp_check_const_attributes accessed TREE_VALUE of a tree that happened to be > > expr_pack_expansion. Since here we're merely trying to evaluate constexpr > > arguments, I thought we could skip such bogus arguments. > > Hmm, attributes should always be a TREE_LIST, lots of places assume > that. Why isn't the pack expansion wrapped in a TREE_LIST? I believe you did that on purpose. There pack comes from cp_parser_std_attribute_list. We could wrap it into a TREE_LIST, but then tsubst_attribute would have to be tweaked to handle the pack expansion correctly. Since this is invalid code, it didn't seem worth it. Normally we remove the attribute in save_template_attributes: if (processing_template_decl) { if (check_for_bare_parameter_packs (attributes)) return; save_template_attributes (&attributes, decl, flags); } cp_check_const_attributes (attributes); so attributes is null after calling cp_check_const_attributes. But this test is invalid so save_template_attributes doesn't do anything and then cp_check_const_attributes crashes on the expr_pack_expansion. Marek