http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58585
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #4) > I think I understand the problem now. The binfos of C looks like > > BINFO of C, BINFO vtable is C's vtable > BASE: > BINFO of B, BINFO vtable is non-NULL, offset is 8 > BASE: > BINFO of A, BINFO vtable is non-NULL, offset is 0. > > i.e. by the virtual inheritance the A is outside layout of B. So while B's > VTABLE is set, A's VTABLE should be VTABLE of C, my code however considers > VTABLE of B. Right. > Is there way how to keep track of the vtables w/o doing the walk based on > fields instead of BINFO_BASEs? There should be. Your code change makes sense to me; a primary base will always be at offset 0, and from the comment those are the only ones we want to walk into.