From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29802 invoked by alias); 17 Nov 2002 10:26:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 29775 invoked by uid 71); 17 Nov 2002 10:26:02 -0000 Resent-Date: 17 Nov 2002 10:26:02 -0000 Resent-Message-ID: <20021117102602.29774.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, grigory@stl.sarov.ru Received: (qmail 29435 invoked by uid 61); 17 Nov 2002 10:21:54 -0000 Message-Id: <20021117102154.29434.qmail@sources.redhat.com> Date: Fri, 22 Nov 2002 11:18:00 -0000 From: grigory@stl.sarov.ru Reply-To: grigory@stl.sarov.ru To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8612: Vtable layout: missing vcall offset X-SW-Source: 2002-11/txt/msg00848.txt.bz2 List-Id: >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: