diff options
author | Kostya Serebryany <kcc@google.com> | 2016-08-24 21:03:28 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-08-24 21:03:28 +0000 |
commit | 0f220064d23328c9ee5106d252c013752d77c8f4 (patch) | |
tree | 74a55c8782c1e13d34699377fc0a11f97351e6de /test/ubsan | |
parent | 41eabf5ccff29b99228414e892311592ae3aa1fa (diff) |
[ubsan] fix the test to me more resistent against changes in the sanitizer allocator
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ubsan')
-rw-r--r-- | test/ubsan/TestCases/TypeCheck/vptr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ubsan/TestCases/TypeCheck/vptr.cpp b/test/ubsan/TestCases/TypeCheck/vptr.cpp index 86b646da7..62fb4ed08 100644 --- a/test/ubsan/TestCases/TypeCheck/vptr.cpp +++ b/test/ubsan/TestCases/TypeCheck/vptr.cpp @@ -50,6 +50,8 @@ struct V : S {}; // Make p global so that lsan does not complain. T *p = 0; +volatile void *sink1, *sink2; + int access_p(T *p, char type); int main(int argc, char **argv) { @@ -74,6 +76,11 @@ int main(int argc, char **argv) { char Buffer[sizeof(U)] = {}; char TStorage[sizeof(T)]; + // Allocate two dummy objects so that the real object + // is not on the boundary of mapped memory. Otherwise ubsan + // will not be able to describe the vptr in detail. + sink1 = new T; + sink2 = new U; switch (argv[1][1]) { case '0': p = reinterpret_cast<T*>(Buffer); |