[PATCH] [ms-cxxabi] Emit linkonce complete dtors in TUs that need them

Peter Collingbourne peter at pcc.me.uk
Fri Jul 19 13:40:12 PDT 2013


On Fri, Jul 19, 2013 at 01:11:18PM -0700, John McCall wrote:
> On Jul 19, 2013, at 12:28 PM, Reid Kleckner <rnk at google.com> wrote:
> > +  // XXX: In the Microsoft ABI, we want to emit a delegating complete dtor
> > +  // without a definition, which means we won't be able to tell if the
> > +  // definition is a try body.  In this case, MSVC simply delegates, so we do
> > +  // the same.
> > 
> > What is this XXX about?  Is this a FIXME?  It looks like we're actually doing it.
> > 
> > I should remove that.  I'm still confused about why destructors defined as try bodies need to be a special case, but the current behavior should be compatible with cl.exe.
> 
> You can’t delegate the base construction when there’s a try body and virtual
> bases because then the try body would appear twice on the stack.

Well, cl.exe seems to delegate it anyway.  This seems to be a
deficiency in the ABI.  I remember running an experiment in which a
destructor throws an exception caught in the try body of a virtually
derived class.  This caused the program (compiled with cl.exe)
to segfault.

We might want to issue a warning if we see a destructor of a class with
virtual bases defined using a try body when compiling for this ABI.

Thanks,
-- 
Peter



More information about the cfe-commits mailing list