aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/asan/TestCases/malloc-no-intercept.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/asan/TestCases/malloc-no-intercept.c b/test/asan/TestCases/malloc-no-intercept.c
new file mode 100644
index 000000000000..563f2ab15691
--- /dev/null
+++ b/test/asan/TestCases/malloc-no-intercept.c
@@ -0,0 +1,24 @@
+// Test that on non-glibc platforms, a number of malloc-related functions are
+// not intercepted.
+
+// RUN: not %clang_asan -Dtestfunc=mallinfo %s -o %t
+// RUN: not %clang_asan -Dtestfunc=mallopt %s -o %t
+// RUN: not %clang_asan -Dtestfunc=memalign %s -o %t
+// RUN: not %clang_asan -Dtestfunc=pvalloc %s -o %t
+// RUN: not %clang_asan -Dtestfunc=cfree %s -o %t
+
+#include <stdlib.h>
+
+// For glibc, cause link failures by referencing a nonexistent function.
+#ifdef __GLIBC__
+#undef testfunc
+#define testfunc nonexistent_function
+#endif
+
+void testfunc(void);
+
+int main(void)
+{
+ testfunc();
+ return 0;
+}