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 13static volatile void *x; 14 15int 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" } */ 23