aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/hwasan/aligned-alloc.c
blob: d38b1f3f62d97dc3f5c3882137c370700fd4f9a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do run } */
/* { dg-require-effective-target hwaddress_exec } */
/* { dg-shouldfail "hwasan" } */
/* This program fails at runtime in the libhwasan library.
   The allocator can't handle the requested invalid alignment.  */

int
main ()
{
  void *p = __builtin_aligned_alloc (17, 100);
  if (((unsigned long long)p & 0x10) == 0)
    return 0;
  return 1;
}

/* { dg-output "HWAddressSanitizer: invalid alignment requested in aligned_alloc: 17" } */