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:
Created attachment 57724 [details] The test case
This testcase is wrong; vptr[-3] is R's vbase pointer in S.