This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13115] [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: 25 Nov 2003 03:25:36 -0000
- Subject: [Bug c++/13115] [ABI] wrong class hierarchy
- References: <20031118211525.13115.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-25 03:25 -------
(In reply to comment #3)
> Not a bug. your analysis is wrong.
> >This time, C is put at offset 12, but G's E's C's A object is put at offset
16,
> >and G's F's C's A is put at offset 12, so is G's C's A is also at offset12.
> >This is wrong, since these A should be the same A object.
> No, those are distinct A objects. A is inherited both virtually and non-
virtually
> within the heirarchy
Thanks for the quick reply. But I don't agree with you. In this testcase, there
are three different A objects in the class layout of G. One is a virtual base A
object which is from B's route. Another is D's A object. And a third one is
C's A object. The third A object can be reached from three different paths. It
can be reached from G->C->A, from G->E->C->A, or from G->F->C->A. Since C is a
virtual base of G, these three A objects should refer to the same A object. But
g++ with option -qabi-version=2, givea different offsets for the same A object.
The following is our compiler's results:
Class G
size=16 align=4
G (0x00000000) 0
vptridx=0 vptr=((&G::_ZTV1G) + 20)
E (0x00000000) 0 nearly-empty
primary-for G (0x00000000)
subvttidx=4
B (0x00000000) 0 nearly-empty
primary-for E (0x00000000)
subvttidx=8
A (0x00000000) 0 empty virtual canonical
vbaseoffset=-12
C (0x00000000) 12 empty virtual canonical
vbaseoffset=-16
A (0x00000000) 12 empty
F (0x00000000) 4
subvttidx=12 vptridx=20 vptr=((&G::_ZTV1G) + 44)
D (0x00000000) 4 nearly-empty virtual canonical
primary-for F (0x00000000)
vptridx=24 vbaseoffset=-20
A (0x00000000) 4 empty
C (0x00000000) 12 empty virtual canonical
vbaseoffset=-16
A (0x00000000) 12 empty
C (0x00000000) 12 empty virtual canonical
vbaseoffset=-16
A (0x00000000) 12 empty
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13115