From: Jason Merrill <jason@redhat.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Ping Re: [PATCH RFC] c++: lambda mangling alias issues [PR107897]
Date: Tue, 14 Mar 2023 11:16:21 -0400 [thread overview]
Message-ID: <dad4f876-4940-23a9-a9ab-540354518b99@redhat.com> (raw)
In-Reply-To: <cc6f7895-a860-d44b-e438-c8476c055998@redhat.com>
On 3/8/23 11:54, Jason Merrill wrote:
> On 3/8/23 11:15, Jason Merrill wrote:
>> On 3/8/23 10:53, Jan Hubicka wrote:
>>>> Tested x86_64-pc-linux-gnu. Does this look good, or do we want to
>>>> factor the
>>>> flag clearing into a symtab_node counterpart to cgraph_node::reset?
>>>>
>>>> -- 8< --
>>>>
>>>> In 107897, by the time we are looking at the mangling clash, the
>>>> alias has already been removed from the symbol table by
>>>> analyze_functions,
>>>> so we can't look at n->cpp_implicit_alias. So just assume that it's an
>>>> alias if it's internal.
>>>>
>>>> In 108887 the problem is that removing the mangling alias from the
>>>> symbol
>>>> table confuses analyze_functions, because it ended up as first_analyzed
>>>> somehow, so it becomes a dangling pointer. Fixed by clearing
>>>> various flags
>>>> to neutralize the alias.
>>>>
>>>> PR c++/107897
>>>> PR c++/108887
>>>>
>>>> gcc/cp/ChangeLog:
>>>>
>>>> * decl2.cc (record_mangling): Improve symbol table handling.
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>> * g++.dg/cpp2a/concepts-lambda3.C: Use -flto if supported.
>>>> * g++.dg/cpp0x/lambda/lambda-mangle7.C: New test.
>>>> ---
>>>> gcc/cp/decl2.cc | 25 +++++--
>>>> .../g++.dg/cpp0x/lambda/lambda-mangle7.C | 70
>>>> +++++++++++++++++++
>>>> gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C | 1 +
>>>> 3 files changed, 91 insertions(+), 5 deletions(-)
>>>> create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle7.C
>>>>
>>>> diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
>>>> index 387e24542cd..e6e58b08de4 100644
>>>> --- a/gcc/cp/decl2.cc
>>>> +++ b/gcc/cp/decl2.cc
>>>> @@ -4742,15 +4742,30 @@ record_mangling (tree decl, bool need_warning)
>>>> = mangled_decls->find_slot_with_hash (id,
>>>> IDENTIFIER_HASH_VALUE (id),
>>>> INSERT);
>>>> - /* If this is already an alias, remove the alias, because the real
>>>> + /* If this is already an alias, cancel the alias, because the real
>>>> decl takes precedence. */
>>>> if (*slot && DECL_ARTIFICIAL (*slot) && DECL_IGNORED_P (*slot))
>>>> - if (symtab_node *n = symtab_node::get (*slot))
>>>> - if (n->cpp_implicit_alias)
>>>> + {
>>>> + if (symtab_node *n = symtab_node::get (*slot))
>>>> {
>>>> - n->remove ();
>>>> - *slot = NULL_TREE;
>>>> + if (n->cpp_implicit_alias)
>>>> + {
>>>> + /* Actually removing the node isn't safe if other code is
>>>> already
>>>> + holding a pointer to it, so just neutralize it. */
>>>> + n->remove_from_same_comdat_group ();
>>>> + n->analyzed = false;
>>>> + n->definition = false;
>>>> + n->alias = false;
>>>> + n->cpp_implicit_alias = false;
>>> We have n->reset () for that which is used in similar situation when
>>> frontends overwrites extern inline function by its different offline
>>> implementation.
>>
>> The problem there is that reset() is a member of cgraph_node, not
>> symtab_node, and I need something that works for variables as well.
>>
>>> reset doesn't call remove_from_same_comdat_group probably because it was
>>> never used on anything in comdat group. So I think it would make sense
>>> to call n->reset() here and add remove_from_same_comdat_group into that.
>
> How about moving it to symtab_node and using dyn_cast for the cgraph
> bits, like this:
Ping? (Patch in attachment in earlier message)
next prev parent reply other threads:[~2023-03-14 15:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 2:59 Jason Merrill
2023-03-08 15:53 ` Jan Hubicka
2023-03-08 16:15 ` Jason Merrill
2023-03-08 16:54 ` Jason Merrill
2023-03-14 15:16 ` Jason Merrill [this message]
2023-03-28 15:32 ` PING^2 " Jason Merrill
2023-03-29 22:33 ` Martin Jambor
2023-03-30 11:54 ` Jan Hubicka
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=dad4f876-4940-23a9-a9ab-540354518b99@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/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).