Index: test/msan/dtor-trivial.cpp =================================================================== --- test/msan/dtor-trivial.cpp +++ test/msan/dtor-trivial.cpp @@ -4,7 +4,9 @@ // RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1 -// TODO Success pending on resolution of 596 +// TODO Success pending on resolution of +// https://github.com/google/sanitizers/issues/596 + // XFAIL: * #include Index: test/msan/dtor-vtable.cc =================================================================== --- test/msan/dtor-vtable.cc +++ test/msan/dtor-vtable.cc @@ -4,36 +4,24 @@ // RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1 -// TODO Success pending on resolution of 596 +// Expected to quit due to invalid access when invoking +// function using vtable. // XFAIL: * -#include #include -template class Vector { - public: - int size; - ~Vector() {} -}; - -struct NonTrivial { - int a; - Vector v; -}; - -struct Trivial { - int a; - int b; +class A { +public: + int x; + virtual ~A() {} + virtual void A_Foo() {} }; int main() { - NonTrivial *nt = new NonTrivial(); - nt->~NonTrivial(); - assert(__msan_test_shadow(nt, sizeof(*nt)) != -1); - - Trivial *t = new Trivial(); - t->~Trivial(); - assert(__msan_test_shadow(t, sizeof(*t)) != -1); - + // Get pointer to virtual function in base class + A *a = new A(); + a->~A(); + // Shouldn't be allowed to invoke function via vtable. + a->A_Foo(); return 0; }