From: Jason Merrill <jason@redhat.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2] v3: C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
Date: Wed, 12 Dec 2018 20:37:00 -0000 [thread overview]
Message-ID: <f9e60b40-7dff-bea0-ddf5-a9da35684a14@redhat.com> (raw)
In-Reply-To: <1544213612-64705-1-git-send-email-dmalcolm@redhat.com>
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
next prev parent reply other threads:[~2018-12-12 20:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-05 19:44 [PATCH 1/2] " David Malcolm
2018-11-05 19:44 ` [PATCH 2/2] C++: improvements to binary operator diagnostics (PR c++/87504) David Malcolm
2018-11-19 16:51 ` [PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486) David Malcolm
2018-12-03 22:10 ` Jeff Law
2018-12-04 15:20 ` David Malcolm
2018-12-04 21:48 ` [PATCH 1/2] v2: " David Malcolm
2018-12-04 21:48 ` [PATCH 2/2] v2: C++: improvements to binary operator diagnostics (PR c++/87504) David Malcolm
2018-12-11 19:52 ` PING " David Malcolm
2018-12-12 20:43 ` Jason Merrill
2018-12-19 23:28 ` Aaron Sawdey
2018-12-20 2:13 ` [PATCH] -Wtautological-compare: fix comparison of macro expansions David Malcolm
2018-12-20 14:29 ` David Malcolm
2018-12-20 23:35 ` Aaron Sawdey
2018-12-04 23:31 ` [PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486) Jason Merrill
2018-12-07 19:25 ` [PATCH 1/2] v3: " David Malcolm
2018-12-12 20:37 ` Jason Merrill [this message]
2018-12-13 19:24 ` [PATCH] v4: " David Malcolm
2018-12-13 20:38 ` Jason Merrill
2018-12-14 23:29 ` [PATCH] v5: " David Malcolm
2018-12-17 19:33 ` Jason Merrill
2018-12-17 23:30 ` David Malcolm
2018-12-18 20:23 ` Jason Merrill
2018-12-18 20:34 ` [PATCH] v6: " David Malcolm
2018-12-18 20:40 ` Jason Merrill
2018-12-19 15:35 ` David Malcolm
2018-12-19 19:01 ` [PATCH 1/2] " Thomas Schwinge
2018-12-20 2:29 ` David Malcolm
2020-03-26 5:02 ` [PATCH, OpenACC] Bug fix for processing OpenACC data clauses in C++ Sandra Loosemore
[not found] ` <4a68ec90-456a-cf49-036e-471ba275706c@codesourcery.com>
2020-03-26 14:27 ` C++ 'NON_LVALUE_EXPR' in OMP array section handling (was: [PATCH, OpenACC] Bug fix for processing OpenACC data clauses in C++) Thomas Schwinge
2020-03-26 15:09 ` C++ 'NON_LVALUE_EXPR' in OMP array section handling Sandra Loosemore
2020-03-26 20:53 ` Thomas Schwinge
2020-05-25 10:56 ` [WIP] Fold 'NON_LVALUE_EXPR' some more (was: C++ 'NON_LVALUE_EXPR' in OMP array section handling) Thomas Schwinge
2020-11-26 9:36 ` Don't create location wrapper nodes within OpenACC clauses (was: [WIP] Fold 'NON_LVALUE_EXPR' some more (was: C++ 'NON_LVALUE_EXPR' in OMP array section handling)) Thomas Schwinge
2020-11-26 10:02 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f9e60b40-7dff-bea0-ddf5-a9da35684a14@redhat.com \
--to=jason@redhat.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).