1// Test allocator aliases.
2//
3// RUN: %clangxx_hwasan -O0 %s -o %t && %run %t
4
5#include <sanitizer/hwasan_interface.h>
6
7int main() {
8 void *volatile sink;
9 sink = (void *)&__sanitizer_posix_memalign;
10 sink = (void *)&__sanitizer_memalign;
11 sink = (void *)&__sanitizer_aligned_alloc;
12 sink = (void *)&__sanitizer___libc_memalign;
13 sink = (void *)&__sanitizer_valloc;
14 sink = (void *)&__sanitizer_pvalloc;
15 sink = (void *)&__sanitizer_free;
16 sink = (void *)&__sanitizer_cfree;
17 sink = (void *)&__sanitizer_malloc_usable_size;
18 sink = (void *)&__sanitizer_mallinfo;
19 sink = (void *)&__sanitizer_mallopt;
20 sink = (void *)&__sanitizer_malloc_stats;
21 sink = (void *)&__sanitizer_calloc;
22 sink = (void *)&__sanitizer_realloc;
23 sink = (void *)&__sanitizer_reallocarray;
24 sink = (void *)&__sanitizer_malloc;
25
26 // sanity check
27 void *p = __sanitizer_malloc(size: 100);
28 p = __sanitizer_realloc(ptr: p, size: 200);
29 __sanitizer_free(ptr: p);
30}
31

source code of compiler-rt/test/hwasan/TestCases/sanitizer_malloc.cpp