[libcxx] r278736 - Fix new ASAN failures

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 13:50:01 PDT 2016


Author: ericwf
Date: Mon Aug 15 15:50:01 2016
New Revision: 278736

URL: http://llvm.org/viewvc/llvm-project?rev=278736&view=rev
Log:
Fix new ASAN failures

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

Modified: libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp?rev=278736&r1=278735&r2=278736&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan.pass.cpp Mon Aug 15 15:50:01 2016
@@ -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
     }
 }

Modified: libcxx/trunk/test/support/test.support/test_macros_header_rtti.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.support/test_macros_header_rtti.pass.cpp?rev=278736&r1=278735&r2=278736&view=diff
==============================================================================
--- libcxx/trunk/test/support/test.support/test_macros_header_rtti.pass.cpp (original)
+++ libcxx/trunk/test/support/test.support/test_macros_header_rtti.pass.cpp Mon Aug 15 15:50:01 2016
@@ -25,4 +25,5 @@ struct B : A {};
 int main() {
     A* ptr = new B;
     (void)dynamic_cast<B*>(ptr);
+    delete ptr;
 }




More information about the cfe-commits mailing list