aboutsummaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Linux/mallopt.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common/TestCases/Linux/mallopt.cc')
-rw-r--r--test/sanitizer_common/TestCases/Linux/mallopt.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/mallopt.cc b/test/sanitizer_common/TestCases/Linux/mallopt.cc
new file mode 100644
index 000000000..0aa9f9844
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Linux/mallopt.cc
@@ -0,0 +1,9 @@
+// Check that mallopt does not return invalid values (ex. -1).
+// RUN: %clangxx -O2 %s -o %t && %run %t
+#include <assert.h>
+#include <malloc.h>
+
+int main() {
+ int res = mallopt(M_ARENA_MAX, 0);
+ assert(res == 0 || res == 1);
+}