https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115410
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to user202729 from comment #7) > (In reply to Andrew Pinski from comment #6) > > They can be different due to the way shared libraries work. > > Ah, too bad. > > Is it safe to at least assume that the function pointers inside the virtual > pointer table be equal then? No, there can be multiple definitions of a symbol, with different addresses. The original motivation was to devirtualize the > function call inside something like (though this would be a different PR) > > if(typeid(*x)==typeid(A)) > x->f(); > > then would it be safe to assume `x->_vptr[0] == &A::f`? No, but the transformation might be valid anyway. There could be multiple copies of A::f with different addresses, but they all have to have the same effects and so it doesn't matter which one gets called.