[PATCH] Skip Ubsan's vptr checks on constructors and destructors.
Richard Smith
richard at metafoo.co.uk
Tue Jul 15 16:27:27 PDT 2014
It's not OK to just turn off this checking for everyone. It's also not appropriate to blindly turn off all checks in a constructor or destructor. This also doesn't do the right thing for code invoked from a constructor or destructor.
Instead, I'd suggest you do the following:
* When a complete object constructor starts for a polymorphic class type, write a record to a (thread-local) stack indicating the address, size, and type_info of the complete object.
* When the sanitizer runtime detects a problem, check this side-table. If the access is to a subobject that would be present once the complete object is constructed, suppress the diagnostic (possibly based on a runtime flag).
http://reviews.llvm.org/D4528
More information about the cfe-commits
mailing list