[C++ Patch] PR 90909 ("[10 Regression] call devirtualized to pure virtual")

Paolo Carlini paolo.carlini@oracle.com
Fri Jun 21 19:29:00 GMT 2019


On 21/06/19 20:50, Jason Merrill wrote:
> On 6/20/19 12:24 AM, Paolo Carlini wrote:
>> Hi,
>> this bug notices that the more aggressive de-virtualization check 
>> that we have now in place (fixed c++/67184) doesn't work correctly 
>> for the below reproducer, which involves a pure virtual: we 
>> de-virtualize and the build fails at link-time. To cure this I 
>> believe we simply want an additional DECL_PURE_VIRTUAL_P in the 
>> condition.
> I don't see why this bug would be specific to pure virtual functions, 
> so the fix also should not be.  If S1::f is not pure virtual, I'd 
> expect that we wrongly devirtualize to it in the same way.
> Devirtualizing the call in S4 is a good optimization, we're just 
> selecting the wrong function.
> It seems like the issue here is that the using-declaration hides the 
> final overrider from lookup.  So we need to work harder to find the 
> actual final overrider, perhaps by looking into the argtype vtable.

I see, thanks for the suggestion.

The issue seems rather tricky, then. For the time being I'm going to 
revert the recent improvements. Probably I'm also going to unassign 
myself, because I don't want to prevent somebody else more knowledgeable 
than me in the area from contributing a good solution.

Thanks, Paolo.

More information about the Gcc-patches mailing list