From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80793 invoked by alias); 12 Dec 2018 20:37:52 -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 80779 invoked by uid 89); 12 Dec 2018 20:37:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk1-f194.google.com Received: from mail-qk1-f194.google.com (HELO mail-qk1-f194.google.com) (209.85.222.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Dec 2018 20:37:49 +0000 Received: by mail-qk1-f194.google.com with SMTP id q70so11617958qkh.6 for ; Wed, 12 Dec 2018 12:37:49 -0800 (PST) Return-Path: Received: from [192.168.1.132] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id r67sm14339993qkr.28.2018.12.12.12.37.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 12:37:46 -0800 (PST) Subject: Re: [PATCH 1/2] v3: C++: more location wrapper nodes (PR c++/43064, PR c++/43486) To: David Malcolm Cc: Jeff Law , gcc-patches@gcc.gnu.org References: <1544213612-64705-1-git-send-email-dmalcolm@redhat.com> From: Jason Merrill Message-ID: Date: Wed, 12 Dec 2018 20:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <1544213612-64705-1-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00868.txt.bz2 On 12/7/18 3:13 PM, David Malcolm wrote: > On Tue, 2018-12-04 at 18:31 -0500, Jason Merrill wrote: >> On 12/3/18 5:10 PM, Jeff Law wrote: >>> On 11/19/18 9:51 AM, David Malcolm wrote: > [...] >>> @@ -1058,6 +1058,9 @@ grokbitfield (const cp_declarator >>> *declarator, >>> return NULL_TREE; >>> } >>> >>> + if (width) >>> + STRIP_ANY_LOCATION_WRAPPER (width); >> >> Why is this needed? We should already be reducing width to an >> unwrapped >> constant value somewhere along the line. > > "width" is coming from cp_parser_member_declaration, from: > > /* Get the width of the bitfield. */ > width = cp_parser_constant_expression (parser, false, NULL, > cxx_dialect >= cxx11); > > and currently nothing is unwrapping the value. We presumably need to > unwrap (or fold?) it before it is stashed in > DECL_BIT_FIELD_REPRESENTATIVE (value). > > Without stripping (or folding) here, we e.g. lose a warning and get this: > FAIL: g++.dg/abi/empty22.C -std=gnu++98 (test for warnings, line 15) Why does that happen? check_bitfield_decl ought to handle the location wrapper fine. That's where it gets folded. >>> @@ -656,6 +656,9 @@ add_capture (tree lambda, tree id, tree >>> orig_init, bool by_reference_p, >>> listmem = make_pack_expansion (member); >>> initializer = orig_init; >>> } >>> + >>> + STRIP_ANY_LOCATION_WRAPPER (initializer); >> >> Why is this needed? What cares about the tree codes of the capture >> initializer? > > This is used to populate LAMBDA_EXPR_CAPTURE_LIST. Without stripping, > we end up with wrapped VAR_DECLs, rather than the VAR_DECLs themselves, Sure, that sounds fine. > and this confuses things later on, for example leading to: > > PASS -> FAIL : g++.dg/cpp0x/lambda/lambda-type.C -std=c++14 (test for excess errors) > PASS -> FAIL : g++.dg/cpp0x/lambda/lambda-type.C -std=c++17 (test for excess errors) Confuses how? Jason