summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-08-24 21:03:28 +0000
committerKostya Serebryany <kcc@google.com>2016-08-24 21:03:28 +0000
commit6d03d84fac57c1ff6ce29acfe028b19a3e639ff7 (patch)
treedf8e7c43c4438562e7e7619a6ca9f2acc79df452
parent75f0968b3965806cdbad375d17723c29a752fb2d (diff)
downloadbcm5719-llvm-6d03d84fac57c1ff6ce29acfe028b19a3e639ff7.tar.gz
bcm5719-llvm-6d03d84fac57c1ff6ce29acfe028b19a3e639ff7.zip
[ubsan] fix the test to me more resistent against changes in the sanitizer allocator
llvm-svn: 279661
-rw-r--r--compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp b/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp
index 86b646da756..62fb4ed0823 100644
--- a/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp
+++ b/compiler-rt/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);
OpenPOWER on IntegriCloud