[cxx-abi-dev] Question about tail padding

Mark Mitchell mark at codesourcery.com
Thu Aug 22 17:23:20 UTC 2002



--On Thursday, August 22, 2002 06:16:27 PM +0100 Nathan Sidwell 
<nathan at codesourcery.com> wrote:

> Mark Mitchell wrote:
>
>> > This is a different problem to the one Mark brought up.
>>
>> It is?
> I've lost context, and I think what I wrote was badly worded.
> IIRC it is the same nvsize issue you brought up, but a different case.
> Your case g++ & hp got right, intel got wrong. this case g++ gets
> wrong (hp & intel are untested).
>
> There's also an issue with bitfields that popped up. I think the ABI
> doc is 'vague' and g++ does inconsistent things
>
> something like
> 	struct A { virtual ~A();
> 		  int a : 2;};
> 	struct B : A { int b  :2;};
> 	struct C { A a; int c : 2;};
> where should B::b and C::c be allocated? in a new allocation unit
> or in the next 2 bits of the same unit that A::a is in? The abi
> says 'if the preceeding byte is partially filled by a bitfield'
>
> g++ 3.2 reports (i686)
> A 8 bytes
> B 8 bytes
> C 12 bytes
>
> B & C should have the same layout AFAICT from the ABI.

Yes.  The intent was certainly that B have 12 bytes, like C; otherwise,
as Scott pointed out it is impossible to create efficient copy
constructors and such.

Again, what to HP and Intel do?

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the cxx-abi-dev mailing list