(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
hwasan/
asan-rlimit-mmap-test-1.c
       1  /* Check that we properly report mmap failure. */
       2  
       3  /* { dg-do run { target setrlimit } } */
       4  /* { dg-require-effective-target hwaddress_exec } */
       5  /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
       6  /* { dg-require-effective-target hw } */
       7  /* { dg-shouldfail "hwasan" } */
       8  
       9  #include <stdlib.h>
      10  #include <assert.h>
      11  #include <sys/time.h>
      12  #include <sys/resource.h>
      13  
      14  static volatile void *x;
      15  
      16  int main(int argc, char **argv) {
      17    struct rlimit mmap_resource_limit = { 0, 0 };
      18    if (setrlimit(RLIMIT_AS, &mmap_resource_limit)) return 1;
      19    x = malloc(10000000);
      20    return 0;
      21  }
      22  
      23  /* { dg-output "ERROR: Failed to mmap" } */
      24