This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13114] [ABI] wrong class hierarchy


------- Additional Comments From nathan at gcc dot gnu dot org  2003-11-26 13:38 -------
with FSF head I get this layout with -fabi-version=2
ZZ (0x402f4f40) 0
    vptridx=0u vptr=((&ZZ::_ZTV2ZZ) + 12u)
  Z (0x402f4f80) 0 nearly-empty
      primary-for ZZ (0x402f4f40)
      subvttidx=4u
    X (0x402f4fc0) 8 empty virtual
        vbaseoffset=-0x00000000c
      W (0x402fd000) 12 empty
    Y (0x402fd040) 0 empty
      W (0x402fd080) 0 empty
that is bogus, as X's W cannot have a different offset than X itself.

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 understand why -fabi-version=0 should give a different result than
-fabi-version=2, as we've not released an -fabi-version=2 compiler yet (and
therefore not locked down that version of the ABI).

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.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-26 13:38:24
               date|                            |
   Target Milestone|---                         |3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13114


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]