aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
new file mode 100644
index 000000000..9dbbc85f4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
@@ -0,0 +1,22 @@
+/* Check that we properly report mmap failure. */
+
+/* { dg-do run { target setrlimit } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+/* { dg-require-effective-target hw } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+static volatile void *x;
+
+int main(int argc, char **argv) {
+ struct rlimit mmap_resource_limit = { 0, 0 };
+ if (setrlimit(RLIMIT_AS, &mmap_resource_limit)) return 1;
+ x = malloc(10000000);
+ return 0;
+}
+
+/* { dg-output "ERROR: Failed to mmap" } */