comparison gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Check that we properly report mmap failure. */
2
3 /* { dg-do run { target setrlimit } } */
4 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
5 /* { dg-require-effective-target hw } */
6 /* { dg-shouldfail "asan" } */
7
8 #include <stdlib.h>
9 #include <assert.h>
10 #include <sys/time.h>
11 #include <sys/resource.h>
12
13 static volatile void *x;
14
15 int main(int argc, char **argv) {
16 struct rlimit mmap_resource_limit = { 0, 0 };
17 if (setrlimit(RLIMIT_AS, &mmap_resource_limit)) return 1;
18 x = malloc(10000000);
19 return 0;
20 }
21
22 /* { dg-output "ERROR: Failed to mmap" } */