ASAN: emit line information of stack variables.
[official-gcc.git] / gcc / testsuite / gcc.dg / asan / use-after-scope-5.c
blob1c2fafb43be1c2028de8b9b472d37372bf069e0b
1 // { dg-do run }
2 // { dg-shouldfail "asan" }
4 int *ptr;
6 __attribute__((always_inline))
7 inline static void
8 foo(int v)
10 int values[10];
11 for (unsigned i = 0; i < 10; i++)
12 values[i] = v;
14 ptr = &values[3];
17 int
18 main (int argc, char **argv)
20 foo (argc);
22 return *ptr;
25 // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
26 // { dg-output "READ of size 4 at.*" }
27 // { dg-output ".*'values' \\(line 10\\) <== Memory access at offset \[0-9\]* is inside this variable.*" }