| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target hwaddress_exec } */ |
| 3 |
/* { dg-shouldfail "hwasan" } */ |
| 4 |
|
| 5 |
/* |
| 6 |
Tests of nested funtions are: |
| 7 |
0) Accessing closed over variables works. |
| 8 |
1) Accesses outside of variables is caught. |
| 9 |
2) Accessing variable out of scope is caught. |
| 10 |
|
| 11 |
Here we test option 1. |
| 12 |
*/ |
| 13 |
|
| 14 |
#define MAIN 0 |
| 15 |
#include "nested-functions-0.c" |
| 16 |
#undef MAIN |
| 17 |
|
| 18 |
int main () |
| 19 |
{ |
| 20 |
nested_function (1); |
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
/* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */ |
| 25 |
/* { dg-output "WRITE of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */ |
| 26 |
/* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */ |
| 27 |
/* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */ |