| 1 |
// { dg-do run } |
| 2 |
// { dg-shouldfail "asan" } |
| 3 |
// { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } |
| 4 |
// { dg-additional-options "-fdump-tree-asan1 -ffat-lto-objects" } |
| 5 |
|
| 6 |
int |
| 7 |
main (int argc, char **argv) |
| 8 |
{ |
| 9 |
int *ptr = 0; |
| 10 |
|
| 11 |
{ |
| 12 |
int a; |
| 13 |
ptr = &a; |
| 14 |
*ptr = 12345; |
| 15 |
} |
| 16 |
|
| 17 |
return *ptr; |
| 18 |
} |
| 19 |
|
| 20 |
// { dg-final { scan-tree-dump-times {= \.ASAN_POISON \(\)} 1 "asan1" } } |
| 21 |
// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } |
| 22 |
// { dg-output "READ of size .*" } |
| 23 |
// { dg-output ".*'a' \\(line 12\\) <== Memory access at offset \[0-9\]* is inside this variable.*" } |