1 // Test that on non-glibc platforms, a number of malloc-related functions are
2 // not intercepted.
3 
4 // RUN: not %clang_asan -Dtestfunc=mallinfo %s -o %t
5 // RUN: not %clang_asan -Dtestfunc=mallopt  %s -o %t
6 // RUN: not %clang_asan -Dtestfunc=memalign %s -o %t
7 // RUN: not %clang_asan -Dtestfunc=pvalloc  %s -o %t
8 // RUN: not %clang_asan -Dtestfunc=cfree    %s -o %t
9 
10 // REQUIRES: glibc-2.27
11 // Conflicts with BIONIC declarations.
12 // Lacks mallinfo, mallopt except in libmalloc.  cfree with different
13 // signature in libc.
14 // UNSUPPORTED: solaris
15 
16 // Inhibit conflicting declaration of memalign on Solaris.
17 #if defined(__sun__) && defined(__svr4__)
18 #undef __EXTENSIONS__
19 #endif
20 
21 #include <stdlib.h>
22 
23 // For glibc, cause link failures by referencing a nonexistent function.
24 #ifdef __GLIBC__
25 #undef testfunc
26 #define testfunc nonexistent_function
27 #endif
28 
29 void testfunc(void);
30 
main(void)31 int main(void)
32 {
33   testfunc();
34   return 0;
35 }
36