From 5f6100260b4d1f9fe194e21ad5a9184c3fc5d137 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 15 Aug 2016 20:50:01 +0000 Subject: [PATCH] Fix new ASAN failures llvm-svn: 278736 --- libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp | 4 ++-- .../support/test.support/test_macros_header_rtti.pass.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp index b102fc08dafb..d3604f0c3a5a 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp @@ -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 } } diff --git a/libcxx/test/support/test.support/test_macros_header_rtti.pass.cpp b/libcxx/test/support/test.support/test_macros_header_rtti.pass.cpp index d189a0efc2fc..dee1a049457e 100644 --- a/libcxx/test/support/test.support/test_macros_header_rtti.pass.cpp +++ b/libcxx/test/support/test.support/test_macros_header_rtti.pass.cpp @@ -25,4 +25,5 @@ struct B : A {}; int main() { A* ptr = new B; (void)dynamic_cast(ptr); + delete ptr; } -- 2.34.1