aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/contiguous_container.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/contiguous_container.cc')
-rw-r--r--test/asan/TestCases/contiguous_container.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/asan/TestCases/contiguous_container.cc b/test/asan/TestCases/contiguous_container.cc
index 0f3a7db5b060..3f754562af31 100644
--- a/test/asan/TestCases/contiguous_container.cc
+++ b/test/asan/TestCases/contiguous_container.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_asan -O %s -o %t && %run %t
+// RUN: %clangxx_asan -fexceptions -O %s -o %t && %run %t
//
// Test __sanitizer_annotate_contiguous_container.
@@ -26,10 +26,18 @@ void TestContainer(size_t capacity) {
for (size_t idx = size; idx < capacity; idx++)
assert(__asan_address_is_poisoned(beg + idx));
assert(__sanitizer_verify_contiguous_container(beg, mid, end));
- if (mid != beg)
+ assert(NULL ==
+ __sanitizer_contiguous_container_find_bad_address(beg, mid, end));
+ if (mid != beg) {
assert(!__sanitizer_verify_contiguous_container(beg, mid - 1, end));
- if (mid != end)
+ assert(mid - 1 == __sanitizer_contiguous_container_find_bad_address(
+ beg, mid - 1, end));
+ }
+ if (mid != end) {
assert(!__sanitizer_verify_contiguous_container(beg, mid + 1, end));
+ assert(mid == __sanitizer_contiguous_container_find_bad_address(
+ beg, mid + 1, end));
+ }
}
// Don't forget to unpoison the whole thing before destroing/reallocating.