This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13114] [ABI] wrong class hierarchy
- From: "yanliu at ca dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Nov 2003 16:46:19 -0000
- Subject: [Bug c++/13114] [ABI] wrong class hierarchy
- References: <20031118203607.13114.yanliu@ca.ibm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From yanliu at ca dot ibm dot com 2003-11-26 16:46 -------
>With -fabi-version=0 I get the following layout
>Class Z
> size=8 align=4
> base size=4 base align=4
>Z (0x402f4b00) 0 nearly-empty
> vptridx=0u vptr=((&Z::_ZTV1Z) + 12u)
> X (0x402f4b40) 4 empty virtual
> vbaseoffset=-0x00000000c
> W (0x402f4b80) 4 empty
> Y (0x402f4bc0) 0 empty
> W (0x402f4c00) 0 empty
>which is correct.
I don't think the above class hierarchy is correct. If X and W are at offset 4,
it means that they share the same offset with ZZ data member " int i". I don't
think that is intentional.
>The layout IBM's VAC++ compiler is given is also incorrect. There
>cannot be an empty struct W hanging off the end of ZZ. If you create an
>array of them, X's W at index N will have the same address as Y's W at index
>N+1.
I agree. We were trying to match with GCC's behaviour at that time. And now GCC
3.2.2 on linuxppc still puts empty class at offset greater than the class size.
I do notice that GCC 3.3.3 with -fabi-version=2/0, the class size has been
increased to hold the empty base class.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13114