From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56370 invoked by alias); 14 Jun 2018 20:46:56 -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 55562 invoked by uid 89); 14 Jun 2018 20:46:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-ot0-f194.google.com Received: from mail-ot0-f194.google.com (HELO mail-ot0-f194.google.com) (74.125.82.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jun 2018 20:46:54 +0000 Received: by mail-ot0-f194.google.com with SMTP id h6-v6so8687603otj.0 for ; Thu, 14 Jun 2018 13:46:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0iitg9PK6e27nR2JDYSSn2irU1nNNkAVcrRFDE+0MT8=; b=QKYpnsAgo4bUgDHwWgH0NDX8vbwOARV/JZyBSF6sHGX7uAFNp2Gpn06tUY3VCLzKrR 2xWzHNPd/TktUYC1leoTvS89bNdA6AvnsVK9kM/3hgNrT0H8mq02UYWm8nfMqBA+M7Dc JCoLrVP5DgDXxo6lv4g2HG3bW/9Tl1quX6B5mLvNx6Lm/rQpPqxx+SAqQixhZhc1IHj5 RnzkwMYO0Kmh/wHZRyes8KAUpOZK4jsNtDT7pw48u70I8ezqA9tYyoLNiZZd16gRXwXH 8/KJwlm0OYiIDhwWFZvwWTIEZwJGKqNlmwUTV2Y3cWwc4wICr31ozqy+HNUjpr+1EEwn NINw== X-Gm-Message-State: APt69E2y0kgjyBfONBstXvKcf7Tqd8Xa2kbnt4jVWn/QxB3J1Bdrrs9c AgdhIs8KUJNtR9CsuAFYJloHiges4PzFBzZt9AshyA== X-Google-Smtp-Source: ADUXVKIKBesSDDDlA0e2W1OTOtIYoUbBpeO5F3S8PArXqIgRGU1Ix81pcVyKjd8HDO1lYaY5D9E6ajbgxevM/s9/nEg= X-Received: by 2002:a9d:113c:: with SMTP id g57-v6mr2430185ote.86.1529009212806; Thu, 14 Jun 2018 13:46:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:dd0:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 13:46:32 -0700 (PDT) In-Reply-To: <20180614194052.GH17989@redhat.com> References: <20180606211835.GC28085@redhat.com> <20180614165107.GG17989@redhat.com> <20180614194052.GH17989@redhat.com> From: Jason Merrill Date: Thu, 14 Jun 2018 20:46:00 -0000 Message-ID: Subject: Re: C++ PATCH for c++/86063, ICE with attribute with pack expansion To: Marek Polacek Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00892.txt.bz2 On Thu, Jun 14, 2018 at 3:40 PM, Marek Polacek wrote: > On Thu, Jun 14, 2018 at 12:59:00PM -0400, Jason Merrill wrote: >> On Thu, Jun 14, 2018 at 12:51 PM, Marek Polacek wrote: >> > 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. >> >> How so? tsubst_attribute expects to find a pack expansion in the >> TREE_VALUE of a TREE_LIST. >> And cp_parser_std_attribute_list puts the pack expansion in TREE_VALUE. > > Exactly. But what tsubst_attribute gets currently is > > purpose purpose normal local bindings <(nil)>> > value normal local bindings <(nil)>>> > value arg:0 value > readonly tree_0 arg:0 > alignas4.C:17:19 start: alignas4.C:17:19 finish: alignas4.C:17:29>> > arg:1 >>> > > so if I were to wrap the expr_pack_expansion in a TREE_LIST, I would have to adjust > tsubst_attribute. But cp_check_const_attributes doesn't expect that the TREE_VALUE > of the above is a non-list. Right? Ah, of course, you're already looking at the arguments, I wasn't reading closely enough. The patch is OK. Jason