1 // { dg-do run }
2 // { dg-shouldfail "asan" }
3 
4 int
main(void)5 main (void)
6 {
7   char *ptr;
8   {
9     char my_char[9];
10     ptr = &my_char[0];
11   }
12 
13   return *(ptr+8);
14 }
15 
16 // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
17 // { dg-output "READ of size 1 at.*" }
18 // { dg-output ".*'my_char' \\(line 9\\) <== Memory access at offset \[0-9\]* is inside this variable.*" }
19