Problems with new vtable layout on Itanium with gcc 3.1

Denkhaus, Volker
Mon Jun 10 04:26:00 GMT 2002


we have a serious problem with the new vtable layout of the new gcc 3.1 on
the Itanium platform. We need to create vtables during compile time. The
problems seems to be that we do not only have a 8 byte pointer to the
function, but an additional 8 byte global pointer.
We have tried to solve this in the attached program. The program attached is
the preprocessor output and can be compiled without any other file needed.
In the assembler output one can see that only the 8 byte function pointer is
calculated, but the second pointer seems to be needed too.

In detail:
We have defined a structure IMallocVtbl in line 59001. A second strcuture
CMalloc (line 59019) contains only a pointer to IMallocVtbl. Then we define
a global variable g_pMalloc (line 59033). Later we try to call one of the
member functions (Alloc in this case, which is the 3rd member function) on
line 59292 (g_pMalloc->Alloc(..)); but we end up in the GetSize member
function (which is the 6th member function).

Is this a problem of the calling convention or a problem of the define of
the structure? Or is that a compiler bug?

Any help is highly appreciated.


Volker Denkhaus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/octet-stream
Size: 189070 bytes
Desc: not available
URL: <>

More information about the Gcc-bugs mailing list