We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75f0968 commit 6d03d84Copy full SHA for 6d03d84
compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp
@@ -50,6 +50,8 @@ struct V : S {};
50
// Make p global so that lsan does not complain.
51
T *p = 0;
52
53
+volatile void *sink1, *sink2;
54
+
55
int access_p(T *p, char type);
56
57
int main(int argc, char **argv) {
@@ -74,6 +76,11 @@ int main(int argc, char **argv) {
74
76
75
77
char Buffer[sizeof(U)] = {};
78
char TStorage[sizeof(T)];
79
+ // Allocate two dummy objects so that the real object
80
+ // is not on the boundary of mapped memory. Otherwise ubsan
81
+ // will not be able to describe the vptr in detail.
82
+ sink1 = new T;
83
+ sink2 = new U;
84
switch (argv[1][1]) {
85
case '0':
86
p = reinterpret_cast<T*>(Buffer);
0 commit comments