RFA: New ipa-devirt PATCH for c++/58678 (devirt vs. KDE)

Jason Merrill jason@redhat.com
Wed Mar 5 17:19:00 GMT 2014


This patch fixes the latest 58678 testcase by avoiding speculative 
devirtualization to the destructor of an abstract class, which can never 
succeed: you can't create an object of an abstract class, so the pointer 
must point to an object of a derived class, and the derived class 
necessarily has its own destructor.  Other virtual member functions of 
an abstract class are OK for devirtualization: the destructor is the 
only virtual function that is always overridden in every class.

We could also detect an abstract class by searching through the vtable 
for __cxa_pure_virtual, but I figured it was easy enough for the front 
end to set a flag on the BINFO.

Tested x86_64-pc-linux-gnu.  OK for trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 58678-3.patch
Type: text/x-patch
Size: 4133 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140305/eff75d0b/attachment.bin>


More information about the Gcc-patches mailing list