mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Fix ASAN test failure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290482 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,7 +38,8 @@ int main()
|
|||||||
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||||
C c(std::begin(t), std::end(t));
|
C c(std::begin(t), std::end(t));
|
||||||
c.reserve(2*c.size());
|
c.reserve(2*c.size());
|
||||||
T foo = c[c.size()]; // bad, but not caught by ASAN
|
volatile T foo = c[c.size()]; // bad, but not caught by ASAN
|
||||||
|
((void)foo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ int main()
|
|||||||
assert(!__sanitizer_verify_contiguous_container( c.data(), c.data() + 1, c.data() + c.capacity()));
|
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.
|
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
|
assert(false); // if we got here, ASAN didn't trigger
|
||||||
|
((void)foo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user