[PATCH RFA] cgraph: flatten and same_body aliases [PR96078]

Jason Merrill jason@redhat.com
Thu Feb 25 00:08:34 GMT 2021


On 2/16/21 1:52 PM, Jeff Law wrote:
> 
> 
> On 2/11/21 10:18 PM, Jason Merrill via Gcc-patches wrote:
>> The patch for PR92372 made us start warning about a flatten attribute on an
>> alias.  But in the case of C++ 'tor base/complete variants, the user didn't
>> create the alias, so we shouldn't warn.
>>
>> I could also remove the attribute in maybe_clone_body, but here seems a bit
>> better.
>>
>> Tested x86_64-pc-linux-gnu.  OK for trunk?
>>
>> gcc/ChangeLog:
>>
>> 	PR c++/96078
>> 	* cgraph.c (cgraph_node::create_same_body_alias): Remove flatten
>> 	attribute from alias.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	PR c++/96078
>> 	* g++.dg/ext/attr-flatten1.C: New test.
> But shouldn't we validate that we've got a C++ ctor/dtor rather than
> blindly removing the attribute from all aliases?  ISTM like the patch
> as-is would always suppress warnings when we create a same-body alias
> regardless of why we created a same-body alias.

Fair enough.  How about this approach, instead?  If the target also has 
attribute flatten, we're getting the desired effect even though the 
called symbol is an alias.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cgraph-flatten-and-same_body-aliases-PR96078.patch
Type: text/x-patch
Size: 3161 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210224/43e7790d/attachment.bin>


More information about the Gcc-patches mailing list