ASAN: emit line information of stack variables.
[official-gcc.git] / gcc / testsuite / gcc.dg / asan / use-after-scope-3.c
blob8f8533760c55e356a053cfbf174be5996a34a28c
1 // { dg-do run }
2 // { dg-shouldfail "asan" }
3 // { dg-skip-if "" { *-*-* } { "*" } { "-O0" } }
5 int
6 main (void)
8 char *ptr;
9 char *ptr2;
11 char my_char[9];
12 ptr = &my_char[0];
13 __builtin_memcpy (&ptr2, &ptr, sizeof (ptr2));
16 *(ptr2+9) = 'c';
19 // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
20 // { dg-output "WRITE of size 1 at.*" }
21 // { dg-output ".*'my_char' \\(line 11\\) <== Memory access at offset \[0-9\]* overflows this variable.*" }