Debian Codegraph @

gcc/testsuite/gcc.dg/hwasan/nested-functions-2.c

raw
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 2.
12 */
13
14 #define MAIN 0
15 #include "nested-functions-0.c"
16 #undef MAIN
17
18 int main ()
19 {
20 int *retval = nested_function (2);
21 *retval = 100;
22 return 0;
23 }
24
25 /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */
26 /* { dg-output "WRITE of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */
27 /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */
28 /* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */