Bug 64475 - Missed function pointer in the virtual table
Missed function pointer in the virtual table
Product: Red Hat Linux
Classification: Retired
Component: gcc3 (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2002-05-06 10:52 EDT by Grigory Zagorodnev
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-05-06 10:52:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Grigory Zagorodnev 2002-05-06 10:52:49 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; NetCaptor 

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:

Steps to Reproduce:
Use the testcase

Additional info:
Comment 1 Jakub Jelinek 2002-05-07 13:14:24 EDT
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.