This is the mail archive of the
mailing list for the GCC project.
Size difference in base class between GCC releases
- From: <Paul_Koning at Dell dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 27 Aug 2012 18:48:06 +0000
- Subject: Size difference in base class between GCC releases
I'm doing some checking of data structure layouts in different releases of our code -- which were produced by different releases of GCC (3.3.3 vs. 4.5.4).
One difference I'm seeing that is puzzling is in the handling of base classes. Specifically, the case where a base class has padding at the end to fill it out to a multiple of the alignment.
In GCC 3.3.3, when such a class is used as a base class, that padding is omitted, and the first derived class data member starts right after the last base class real (not pad) data member. In GCC 4.5.4, the base class is used padding and all, the first derived class data member starts after the padding of the base class.
Which is correct? Or are both correct? This sort of thing is a potential cause of trouble if such a class is used as a container for persistent data.