1// RUN: %clang -O0 %s -o %t && %run %t
2
3// FIXME: investigate why this fails on macos
4// UNSUPPORTED: darwin
5
6#include <stdlib.h>
7
8const char *test() __attribute__((disable_sanitizer_instrumentation)) {
9 void *volatile p = malloc(size: 3);
10 p = realloc(ptr: p, size: 7);
11 free(ptr: p);
12
13 p = calloc(nmemb: 3, size: 7);
14 free(ptr: p);
15
16 free(NULL);
17
18 return "";
19}
20
21const char *__asan_default_options()
22 __attribute__((disable_sanitizer_instrumentation)) {
23 return test();
24}
25const char *__hwasan_default_options()
26 __attribute__((disable_sanitizer_instrumentation)) {
27 return test();
28}
29const char *__lsan_default_options()
30 __attribute__((disable_sanitizer_instrumentation)) {
31 return test();
32}
33const char *__memprof_default_options()
34 __attribute__((disable_sanitizer_instrumentation)) {
35 return test();
36}
37const char *__msan_default_options()
38 __attribute__((disable_sanitizer_instrumentation)) {
39 return test();
40}
41const char *__nsan_default_options()
42 __attribute__((disable_sanitizer_instrumentation)) {
43 return test();
44}
45const char *__rtsan_default_options()
46 __attribute__((disable_sanitizer_instrumentation)) {
47 return test();
48}
49const char *__tsan_default_options()
50 __attribute__((disable_sanitizer_instrumentation)) {
51 return test();
52}
53const char *__ubsan_default_options()
54 __attribute__((disable_sanitizer_instrumentation)) {
55 return test();
56}
57
58int main(int argc, char **argv) { return 0; }
59

source code of compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c