Fix new ASAN failures
authorEric Fiselier <eric@efcs.ca>
Mon, 15 Aug 2016 20:50:01 +0000 (20:50 +0000)
committerEric Fiselier <eric@efcs.ca>
Mon, 15 Aug 2016 20:50:01 +0000 (20:50 +0000)
llvm-svn: 278736

libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
libcxx/test/support/test.support/test_macros_header_rtti.pass.cpp

index b102fc08dafbc423b48c15139b47636b2228396f..d3604f0c3a5a4ff3768110848d939f090883dbf0 100644 (file)
@@ -61,8 +61,8 @@ int main()
         C c(std::begin(t), std::end(t));
         c.reserve(2*c.size());
         assert(is_contiguous_container_asan_correct(c));
-        assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity()));
-        T foo = c[c.size()];    // should trigger ASAN
+        assert(!__sanitizer_verify_contiguous_container( c.data(), c.data() + 1, c.data() + c.capacity()));
+        volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
         assert(false);          // if we got here, ASAN didn't trigger
     }
 }
index d189a0efc2fcb61b95ccfe4f60f71a5ea79f97c3..dee1a049457e523a2463cdc116b538db59387ac9 100644 (file)
@@ -25,4 +25,5 @@ struct B : A {};
 int main() {
     A* ptr = new B;
     (void)dynamic_cast<B*>(ptr);
+    delete ptr;
 }