[PATCH][C++] Fix PR38334, TBAA issues with vtbl loads

Richard Guenther rguenther@suse.de
Tue Dec 2 20:02:00 GMT 2008


On Tue, 2 Dec 2008, Mark Mitchell wrote:

> Richard Guenther wrote:
> 
> > vtbl_ptr_type_node is correct, but there is no vtbl_ptr_type member
> > in the structure we are accessing.
> 
> 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.

> In any case, how about using build_vfn_ref here?  It looks to me like
> that's a type-correct function.

It cannot deal with an instance pointer of the form
*(&((struct Container *) this)->item + (unsigned int) itemfun.__delta).

That said, any other ideas are of course appreciated ;)  The testcase
that triggers the warning is g++.dg/opt/pmf1.C if you apply
http://gcc.gnu.org/bugzilla/attachment.cgi?id=16794&action=view

Thanks,
Richard.



More information about the Gcc-patches mailing list