public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8612: Vtable layout: missing vcall offset
@ 2002-11-22 11:18 grigory
  0 siblings, 0 replies; 2+ messages in thread
From: grigory @ 2002-11-22 11:18 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8612
>Category:       c++
>Synopsis:       Vtable layout: missing vcall offset
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 17 02:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Grigory Zagorodnev
>Release:        3.2
>Organization:
>Environment:
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Description:
'C2' is the virtual base of class 'C1' in the given test-case. So the C2-in-C1 virtual table should contains virtual call (vcall) offsets for all virtual functions defined in C2 and it's subobjects.

Class C4 defines virtual function f6 and this class is included twice in the C2 (as direct and indirect non-virtual base). So two vcall entries are expected in the virtual table. However g++ gives only one entry - see vtable layout below.

That should be considered as a bug.

------------------------
The test-case (test.cpp) 
------------------------
struct C4
{
        int m0;
virtual int f6()        { return 4; }
};

struct C7:  C4
{
        int m0;
};

struct C2: C4, C7
{
        int m0;
};

struct C1: virtual C2
{
        short m1;
};

C1 o1;

--------------------
Virtual table layout
--------------------
$ g++ -c -fdump-class-hierarchy test.cpp
$ cat test.cpp.class

Vtable for C1
C1::_ZTV2C1: 10 entries
0     8
4     0
8     &_ZTI2C1
12    8		< -- f6's vcall offset. Why only one?
16    0fffffff8
20    &_ZTI2C1	< -- C2-in-C1 vtable entry point
24    C4::f6()
28    0fffffff0
32    &_ZTI2C1
36    C4::f6()

Class C1
   size=32 align=4
C1 (0x40323200) 0
    vptridx=0 vptr=((&C1::_ZTV2C1) + 12)
  C2 (0x40323240) 8 virtual canonical
      vptridx=4 vbaseoffset=-12 vptr=((&C1::_ZTV2C1) + 24)
    C4 (0x40323300) 8
        primary-for C2 (0x40323240)
    C7 (0x40323280) 16
        vptridx=8 vptr=((&C1::_ZTV2C1) + 36)
      C4 (0x403232c0) 16
          primary-for C7 (0x40323280)
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/8612: Vtable layout: missing vcall offset
@ 2003-02-04 20:57 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2003-02-04 20:57 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, grigory, mmitchel, nathan

Synopsis: Vtable layout: missing vcall offset

Responsible-Changed-From-To: mmitchel->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Tue Feb  4 20:57:35 2003
Responsible-Changed-Why:
    investigated
State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Tue Feb  4 20:57:35 2003
State-Changed-Why:
    the new behaviour is correct. The vcall offset for that
    virtual base is zero. However, there is no interoperatability
    problem, because no vcall adjusting thunk is needed in the
    cited instance.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8612


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-04 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-22 11:18 c++/8612: Vtable layout: missing vcall offset grigory
2003-02-04 20:57 nathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).