| 1 |
/* Test recovery mode. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target hwaddress_exec } */ |
| 4 |
/* { dg-options "-fsanitize-recover=hwaddress" } */ |
| 5 |
/* { dg-set-target-env-var HWASAN_OPTIONS "halt_on_error=false" } */ |
| 6 |
/* { dg-shouldfail "hwasan" } */ |
| 7 |
|
| 8 |
volatile int sixteen = 16; |
| 9 |
|
| 10 |
int main() { |
| 11 |
char x[16]; |
| 12 |
__builtin_memset(x, 0, sixteen + 1); |
| 13 |
asm volatile ("" : : : "memory"); |
| 14 |
volatile int res = x[sixteen]; |
| 15 |
x[sixteen] = res + 3; |
| 16 |
res = x[sixteen]; |
| 17 |
return 0; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-output "WRITE of size 17 at 0x\[0-9a-f\]+.*" } */ |
| 21 |
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+.*" } */ |
| 22 |
/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+.*" } */ |
| 23 |
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+.*" } */ |
| 24 |
|