C++ ABI Issues

Jamie Lokier egcs@tantalophile.demon.co.uk
Mon Aug 26 19:18:00 GMT 2002


Mark Mitchell wrote:
>    G++ incorrectly packs D::i2 into the four bits of tail-padding in
>    B.
> 
>    This is not only an ABI divergence, but also an optimization issue.
>    G++ generates a copy-constructor for B that performs the bit-masking
>    operations required to copy only the bitfield at the end of B, which
>    is more expensive than copying the entire word.

Is there any scenario where the bit-masking is actually necessary?

It seems to me that when B is constructed, it's ok to write to the
padding bits of the destination word.  They might get overwritten again
by later constructors in the sequence, but that is ok.

-- Jamie



More information about the Gcc mailing list