This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12053] New: ABI difference between default g++ 3.3 and g++ 3.2
- From: "grigory at stl dot sarov dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2003 14:07:51 -0000
- Subject: [Bug c++/12053] New: ABI difference between default g++ 3.3 and g++ 3.2
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12053
Summary: ABI difference between default g++ 3.3 and g++ 3.2
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: grigory at stl dot sarov dot ru
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
Overview
--------
IF the last byte (a byte on the alignment boundary) of either virtual or non-
virtual part of the class contains tail of a non-POD base class's bitfield
THEN, besides the bit alignment (to the end of that byte), g++ 3.3 compiler
increases class size by the value of alignment.
That makes object layout generated by g++ 3.3 incompatible with g++ 3.2, while
it's stated that ABI version left unchanged between these two version of g++.
Details
-------
The following class may introduce a bit-field tail in the byte on alignment
boundary. Class must be non-POD!
struct C4
{
int b:30;
C4(){};
};
Next class gives the desired situation. C4 is the last class laid out in C1's
virtual part, b's tail goes into the last byte.
struct C1: virtual C4
{
int i;
};
Expected size of C1 on ia-32 is 12 bytes. G++ 3.2 gives the required dozen,
while g++ 3.3 makes it 16.
Next class illustrates same problem but in non-virtual part. Expected size - 4;
g++ 3.3 gives 8.
struct C2: C4
{
};
Notes
-----
Given problem exists in g++ 3.3 and g++ 3.3.1 in default configuration only. It
is gone when we use -fabi-version=0 key.