[PATCH][C++] Fix PR38334, TBAA issues with vtbl loads
Mark Mitchell
mark@codesourcery.com
Tue Dec 2 20:34:00 GMT 2008
Richard Guenther wrote:
>> Why not? I thought a C++ class with a virtual function would have a
>> member in it that corresponds to the virtual table pointer (possibly
>> inside nested structures).
>
> I think we do not need to know the class in this case dealing with
> pointer-to-member functions.
Oh, I see. You're right; we don't know the static type of the class we
reach by adding delta to the "this" pointer.
However, that means that "this + delta" shouldn't be considered based on
"this". It's not like an array access; it's an access outside the
bounds of "*this" to some object fundamentally unrelated to "*this".
Can we either cast the type of that expression to vtbl**, or can we mark
this + delta as being of an all-aliasing type?
The point is that it's the "this + delta" operation that's weird from a
typing point of view; the subsequent dereference of that pointer is normal.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list