| 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 |
|
| 8 |
const char *test() __attribute__((disable_sanitizer_instrumentation)) { |
| 9 |
void *volatile p = malloc(3); |
| 10 |
p = realloc(p, 7); |
| 11 |
free(p); |
| 12 |
|
| 13 |
p = calloc(3, 7); |
| 14 |
free(p); |
| 15 |
|
| 16 |
free(NULL); |
| 17 |
|
| 18 |
return ""; |
| 19 |
} |
| 20 |
|
| 21 |
const char *__asan_default_options() |
| 22 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 23 |
return test(); |
| 24 |
} |
| 25 |
const char *__hwasan_default_options() |
| 26 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 27 |
return test(); |
| 28 |
} |
| 29 |
const char *__lsan_default_options() |
| 30 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 31 |
return test(); |
| 32 |
} |
| 33 |
const char *__memprof_default_options() |
| 34 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 35 |
return test(); |
| 36 |
} |
| 37 |
const char *__msan_default_options() |
| 38 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 39 |
return test(); |
| 40 |
} |
| 41 |
const char *__nsan_default_options() |
| 42 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 43 |
return test(); |
| 44 |
} |
| 45 |
const char *__rtsan_default_options() |
| 46 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 47 |
return test(); |
| 48 |
} |
| 49 |
const char *__tsan_default_options() |
| 50 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 51 |
return test(); |
| 52 |
} |
| 53 |
const char *__ubsan_default_options() |
| 54 |
__attribute__((disable_sanitizer_instrumentation)) { |
| 55 |
return test(); |
| 56 |
} |
| 57 |
|
| 58 |
int main(int argc, char **argv) { return 0; } |