[PATCH] D36112: [ubsan] Have -fsanitize=vptr emit a null check if -fsanitize=null isn't available

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 04:08:14 PDT 2017


arphaman added a comment.

That makes sense. It's kinda weird not to report the `null`, but I guess it makes sense if the `null` sanitiser is off. It's not actually UB unless it's dereferenced, right, so casts are allowed?



================
Comment at: test/CodeGenCXX/ubsan-type-checks.cpp:73
+// VPTR_NO_NULL-LABEL: define void @_Z13invalid_cast3P3Cat
+void invalid_cast3(Cat *cat = nullptr) {
+  // Fall back to the vptr sanitizer's null check when -fsanitize=null isn't
----------------
Can you use reuse the first `invalid_cast` with different checks since the code is the same?


https://reviews.llvm.org/D36112





More information about the cfe-commits mailing list