c++ code that egcs kills ...

Alexandre Oliva oliva@dcc.unicamp.br
Thu Aug 20 14:23:00 GMT 1998

Glenn W Bach <glenn@dodgson.wonderland.caltech.edu> writes:

> Has this been seen before? Is there hope of fixing it in a future version?

>   B
>  / \
> A   D - E
>  \ /
>   C

> In the above inheritance tree, B and C inherit virtually from A. When an
> object of type E is constructed, D's constructor calls a function in A
> which in turn calls a virtual function overridden by D. This requires a
> downcast from type A to type D, and egcs incorrectly adjusts the object
> pointer, forgetting the size of E's member data.

I believe this is a known problem in the vtable-thunks implementation.
You may work around it by rebuilding libstdc++ with -fno-vtable-thunks 
and compiling any C++ program with -fno-vtable-thunks.

Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
Universidade Estadual de Campinas, SP, Brasil

More information about the Gcc-bugs mailing list