[C++ PATCH] Fix -fsanitize=vptr (PR c++/70147)

Jason Merrill jason@redhat.com
Wed Mar 16 04:11:00 GMT 2016


On 03/15/2016 12:24 PM, Jakub Jelinek wrote:
> Bernd E. mentioned in the PR the problem that if some subobject ctor throws,
> if for -fsanitize=vptr we clear again the vtable pointers even for virtual
> bases then they won't be properly destructed.

> So, here is an incremental patch to the earlier patch, which will clear
> the virtual base vtbl pointers only in the in-charge ctor.

Right. If we aren't in charge of constructing the base, we shouldn't 
mess with its vptr either.  Both patches are OK.

> Though, this brings a non-sanitizer issue, for -flifetime-dse=2
> we emit a clobber of the whole subobject even in a ctor with _vtt_parm
> argument, and the virtual bases at that point might live inside of the
> area that is clobbered by the ctor {CLOBBER}
> (both data and vtable pointers).

See my comment in the PR.

Jason



More information about the Gcc-patches mailing list