This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Vtable incompatibility between GCC 3.0/3.2?
- From: Stephan Bergmann <stephan dot bergmann at sun dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 05 Sep 2003 10:49:34 +0200
- Subject: Vtable incompatibility between GCC 3.0/3.2?
Hi all.
I just found out the hard way :) that there is an incompatibility in
the vtable layout of GCC 3.0.1 and GCC 3.2.2, see below. Can anybody
confirm whether this is a known issue (a deliberate change?), and
between which two GCC versions the change was introduced? I did not
find anything about this in the changes notes.
Thanks a lot in advance,
-Stephan
Compiling file test.cc
struct Base1 { virtual void fnBase1(); };
struct Base2 { virtual void fnBase2(); };
struct Derived: Base1, Base2 {
Derived();
void fnBase2();
virtual void fnDerived();
};
Derived::Derived() {}
void Derived::fnBase2() {}
with
g++ -S test.cc
shows that the GCC-3.0.1--generated
vtable for Derived:
.long 0
.long typeinfo for Derived
.long Base1::fnBase1()
.long Derived::fnDerived()
.long Derived::fnBase2()
.long -4
.long typeinfo for Derived
.long non-virtual thunk to Derived::fnBase2()
differs from the GCC-3.2.2--generated
vtable for Derived:
.long 0
.long typeinfo for Derived
.long Base1::fnBase1()
.long Derived::fnBase2()
.long Derived::fnDerived()
.long -4
.long typeinfo for Derived
.long non-virtual thunk [nv:-4] to Derived::fnBase2()
in that the slots for fnDerived and fnBase2 have switched positions.