Bug 65095 - Virtual table layout: wrong vcall/vbase order for primary base class
Summary: Virtual table layout: wrong vcall/vbase order for primary base class
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc3
Version: 7.2
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-17 12:13 UTC by Grigory Zagorodnev
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-12-15 20:29:27 UTC
Embargoed:


Attachments (Terms of Use)
The test case (1021 bytes, text/plain)
2002-05-17 12:14 UTC, Grigory Zagorodnev
no flags Details

Description Grigory Zagorodnev 2002-05-17 12:13:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; NetCaptor 
6.5.0PB8)

Description of problem:
The C++ ABI syas that...

2.5 Virtual Table Layout 
2.5.2 Virtual Table Components and Order 
"However, in classes sharing a virtual table with a primary base class, the 
vcall and vbase offsets added by the derived class all come before the vcall 
and vbase offsets required by the base class, so that the latter may be laid 
out as required by the base class without regard to additions from the derived 
class(es). "

In the attached testcase, P is the primary base for S. So we are following 
quoted rule for vcall/vbase offsets order in it. Expected S's virtual table 
layout is the following (vptr is the virtual table entry point):
	vptr[-4] S's vbase offset
	vptr[-3] P's vcall offset
	vptr[-2] offset to top
	vptr[-1] typeinfo ptr

g++ compiler violates described rule by changing order of P's vcall and S's 
vbase offsets. It gives the following:
	vptr[-4] P's vcall offset
	vptr[-3] S's vbase offset

PS: Hope there is enough information 8-).


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile testcase 
    g++3 -c fail.cpp

2. Run to see the output


Actual Results:  bad P's vcall offset
bad S's vbase offset

Expected Results:  Passed

Additional info:

Comment 1 Grigory Zagorodnev 2002-05-17 12:14:56 UTC
Created attachment 57724 [details]
The test case

Comment 2 Jason Merrill 2002-06-14 12:37:08 UTC
This testcase is wrong; vptr[-3] is R's vbase pointer in S.



Note You need to log in before you can comment on or make changes to this bug.