| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target hwaddress_exec } */ |
| 3 |
/* { dg-shouldfail "hwasan" } */ |
| 4 |
|
| 5 |
#define alloca __builtin_alloca |
| 6 |
|
| 7 |
int __attribute__ ((noinline)) |
| 8 |
check_alloca (int num) |
| 9 |
{ |
| 10 |
volatile int *allocd_array = (int*)alloca (num * sizeof(int)); |
| 11 |
int other_array[10]; |
| 12 |
return allocd_array[12]; |
| 13 |
} |
| 14 |
|
| 15 |
int __attribute__ ((noinline)) |
| 16 |
main () |
| 17 |
{ |
| 18 |
check_alloca (3); |
| 19 |
return 1; |
| 20 |
} |
| 21 |
|
| 22 |
/* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */ |
| 23 |
/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/\[\[:xdigit:\]\]\[\[:xdigit:\]\].* \\(ptr/mem\\) in thread T0.*" } */ |
| 24 |
/* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */ |
| 25 |
/* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */ |