summaryrefslogtreecommitdiff
path: root/test/ubsan
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-01 17:56:12 +0000
committerVedant Kumar <vsk@apple.com>2017-06-01 17:56:12 +0000
commit0c1676c0068c7bda6cba4a7d24ba1aa500201086 (patch)
tree59c55c08b70695a29ebdf34c2395b169f46bdd53 /test/ubsan
parentbfeededd7ee43fe38262619ec200687875ae82a1 (diff)
Tighten up test to address bot failure. NFC.
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/32035 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ubsan')
-rw-r--r--test/ubsan/TestCases/TypeCheck/PR33221.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ubsan/TestCases/TypeCheck/PR33221.cpp b/test/ubsan/TestCases/TypeCheck/PR33221.cpp
index 17e35a6d9..09411aa50 100644
--- a/test/ubsan/TestCases/TypeCheck/PR33221.cpp
+++ b/test/ubsan/TestCases/TypeCheck/PR33221.cpp
@@ -1,8 +1,10 @@
-// RUN: %clangxx -frtti -fsanitize=undefined -g %s -O3 -o %t
+// RUN: %clangxx -frtti -fsanitize=vptr -g %s -O3 -o %t
// RUN: %run %t 2>&1 | FileCheck %s
// REQUIRES: cxxabi
+#include <string.h>
+
class Base {
public:
int i;
@@ -15,10 +17,12 @@ public:
};
int main() {
- Derived *list = (Derived *)new char[sizeof(Derived)];
+ char *c = new char[sizeof(Derived)];
+ memset((void *)c, 0, sizeof(Derived));
+ Derived *list = (Derived *)c;
// CHECK: PR33221.cpp:[[@LINE+2]]:19: runtime error: member access within address {{.*}} which does not point to an object of type 'Base'
-// CHECK-NEXT: object has invalid vptr
+// CHECK-NEXT: invalid vptr
int foo = list->i;
return 0;
}