Hello,

On Wed, Mar 08 2023, Jason Merrill via Gcc-patches wrote:
> On 3/8/23 11:15, Jason Merrill wrote:
>> On 3/8/23 10:53, Jan Hubicka wrote:
[...]
>>> 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:
> From 1d869ceb04573727e59be6518903133c8654069a Mon Sep 17 00:00:00 2001
> From: Jason Merrill <ja...@redhat.com>
> Date: Mon, 6 Mar 2023 15:33:45 -0500
> Subject: [PATCH] c++: lambda mangling alias issues [PR107897]
> To: gcc-patches@gcc.gnu.org
>
> 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/ChangeLog:
>
>       * cgraph.h: Move reset() from cgraph_node to symtab_node.
>       * cgraphunit.cc (symtab_node::reset): Adjust.
>
> gcc/cp/ChangeLog:
>
>       * decl2.cc (record_mangling): Use symtab_node::reset.

The patch is OK.

Thanks,

Martin

Reply via email to