Bug 64475 - Missed function pointer in the virtual table
Summary: Missed function pointer in the virtual table
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-06 14:52 UTC by Grigory Zagorodnev
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-05-06 14:52:54 UTC
Embargoed:


Attachments (Terms of Use)

Description Grigory Zagorodnev 2002-05-06 14:52:49 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; NetCaptor 
6.5.0PB8)

Description of problem:
Virtual table for the given class W misses second pointer to function W::x.

The class source is:
   struct R {
     virtual void z (void) {}
     virtual void y (void) {}
     virtual R * x (void) { return this; }
   };
   
   struct S : public R { };

   struct W : public S {
     double d;
     virtual long k (void) { return 0l; } 
     W * x (void) { return this; } 
   };

According to the C++ ABI, virtual table should contain "an entry for any 
virtual function declared in a class, whether it is a new function or overrides 
a base class function, unless it overrides a function from the primary base, 
and conversion between their return types does not require an adjustment". [C++ 
ABI, 2.5.2 Virtual Table Components and Order]

g++3 compiler leaves only one pointer to function W::x, i.e. g++3 decides that 
this is the exception case.

But it's not completely clear. further reading of ABI suggests that there 
should be two entries for function 'W::x' for class W and R.



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


How reproducible:
Always

Steps to Reproduce:
Use the testcase

Additional info:

Comment 1 Jakub Jelinek 2002-05-07 17:14:24 UTC
But that's the correct behaviour.
R is W's primary base (there is no multiple inheritance in the example),
likewise conversion from W to R doesn't need any adjustements.


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