egcs-1.1 and virtual method questions

Mike Stump
Thu Nov 19 17:58:00 GMT 1998

> Date: Thu, 19 Nov 98 01:10:58 +0100
> From: Gilles Depeyrot <>
> To: <>

> >    2)  The object's type is in fact foo, you just are confused and thing
> >	it is foobar,

> Nope, that's the first thing I checked using the debugger (gdb) and the
> virtual table is that of foobar.

> >    3)  A compiler bug slicing when it shouldn't (unlikely),
> >    4)  Vtable filling problem (unlikely).

> I *know* its unlikely. I'm trying to understand what is going on and I am
> not a novice in C++ programming, that's why I'm writing to this list.

Ok, check the generated code (-S).  Generate the .s file, duplicate
the call, generate new .s file, diff the two, then you find exactly
where the call site is without getting confused.  Is the callsite call
~Qfoobar_do_something, ~Qfoo_do_something, or fetch a word from object
dereference it, add 8-24 to it, grab that, and call through that

If the later, find the address of the vtable, and from that, the exact
name of the vtable (undemangled) (if a name exists), then take a look
at the .o file that defines the vtable (could be the same .s above, or
another file), generate the .s file for it, and examine lines just
under the vtable definition, and see if it ~Qfoobar_do_something or
~Qfoo_do_something, and ensure that there is only one of them!

Also, these two better have the exact same name and the exact same set
of arguments!  (You'll know this if you find two or more above.)


More information about the Gcc-bugs mailing list