[C++ PATCH] covariant abi conformance

Jason Merrill jason@redhat.com
Tue Jan 28 17:36:00 GMT 2003


On Tue, 28 Jan 2003 15:42:13 +0000, Nathan Sidwell <nathan@codesourcery.com> wrote:

> Jason Merrill wrote:
>>
>> OK, that tells us that we need to emit a thunk with such a mangled name.
>> In fact, we need it for use in more-derived classes, where the base may no
>> longer be primary.  However, I don't see why we need to use this thunk when
>> we know that no adjustment is necessary in the current class.  Seems to me
>> that the as-if rule applies here.

> but it does not apply. The compiler emitting the vtable might not be
> the one emitting the thunks.

So what?  The set of thunks is specified by the ABI.  The compiler emitting
the vtable knows what it has to work with, and it can choose to point
directly at the function rather than the thunk, since the effect is the
same.

>> What would be the point of such a thunk?  No, we need the thunk mentioned
>> above.  We just don't need to put it in the vtable.

> What is the name of the thunk we put in the vtable? The only candidates are
> _Zc_h0_<covariant>_<target> and _Zc_v0_<n>_<covariant>_<target>. The thunk
> is overriding something from a virtual base, and the ABI says that's the
> latter one. The ABI doesn't say use the former when overriding a virtual
> primary base.

Yes; the former would be wrong.  We need to emit a vcall thunk for the case
where the base becomes a lost primary.

> It is unfortunate we didn't notice this when designing the ABI.

I disagree that there is a problem.

Jason



More information about the Gcc-patches mailing list