/* { dg-do run } */
/* { dg-require-effective-target hwaddress_exec } */
/* { dg-shouldfail "hwasan" } */

#define alloca __builtin_alloca

int __attribute__ ((noinline))
check_alloca (int num)
{
  volatile int *allocd_array = (int*)alloca (num * sizeof(int));
  int other_array[10];
  return allocd_array[12];
}

int __attribute__ ((noinline))
main ()
{
  check_alloca (3);
  return 1;
}

/* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */
/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */
/* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */
/* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */
