Skip to content

Commit 1797174

Browse files
vitalybukatxff99
andauthored
[NFC][sanitizer] Commit test for #106912 (#108289)
Almost all sanitizers already support the test. * Tsan does not use DlsymAlloc yet. * Lsan will support with #106912. memprof,rtsan,nsan are not tested as part of sanitizer_common, but we should keep them here to show up when it happen. --------- Co-authored-by: Xiaofeng Tian <[email protected]>
1 parent a66ce58 commit 1797174

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// RUN: %clang -O0 %s -o %t && %run %t
2+
3+
// FIXME: TSAN does not use DlsymAlloc.
4+
// UNSUPPORTED: tsan
5+
6+
// FIXME: https://github.com/llvm/llvm-project/pull/106912
7+
// XFAIL: lsan
8+
9+
#include <stdlib.h>
10+
11+
const char *test() __attribute__((disable_sanitizer_instrumentation)) {
12+
void *volatile p = malloc(3);
13+
p = realloc(p, 7);
14+
free(p);
15+
16+
p = calloc(3, 7);
17+
free(p);
18+
19+
free(NULL);
20+
21+
return "";
22+
}
23+
24+
const char *__asan_default_options()
25+
__attribute__((disable_sanitizer_instrumentation)) {
26+
return test();
27+
}
28+
const char *__hwasan_default_options()
29+
__attribute__((disable_sanitizer_instrumentation)) {
30+
return test();
31+
}
32+
const char *__lsan_default_options()
33+
__attribute__((disable_sanitizer_instrumentation)) {
34+
return test();
35+
}
36+
const char *__memprof_default_options()
37+
__attribute__((disable_sanitizer_instrumentation)) {
38+
return test();
39+
}
40+
const char *__msan_default_options()
41+
__attribute__((disable_sanitizer_instrumentation)) {
42+
return test();
43+
}
44+
const char *__nsan_default_options()
45+
__attribute__((disable_sanitizer_instrumentation)) {
46+
return test();
47+
}
48+
const char *__rtsan_default_options()
49+
__attribute__((disable_sanitizer_instrumentation)) {
50+
return test();
51+
}
52+
const char *__tsan_default_options()
53+
__attribute__((disable_sanitizer_instrumentation)) {
54+
return test();
55+
}
56+
const char *__ubsan_default_options()
57+
__attribute__((disable_sanitizer_instrumentation)) {
58+
return test();
59+
}
60+
61+
int main(int argc, char **argv) { return 0; }

0 commit comments

Comments
 (0)