* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / asan / use-after-scope-2.c
blobdedb73400cdcaa8de856ef9866fb78d1547cee77
1 // { dg-do run }
2 // { dg-shouldfail "asan" }
4 int *bar (int *x, int *y) { return y; }
6 int foo (void)
8 char *p;
10 char a = 0;
11 p = &a;
14 if (*p)
15 return 1;
16 else
17 return 0;
20 int
21 main (void)
23 char *ptr;
25 char my_char[9];
26 ptr = &my_char[0];
29 int a[16];
30 int *p, *q = a;
32 int b[16];
33 p = bar (a, b);
35 bar (a, q);
37 int c[16];
38 q = bar (a, c);
40 int v = *bar (a, q);
41 return v;
45 // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
46 // { dg-output "READ of size 4 at.*" }
47 // { dg-output ".*'c' <== Memory access at offset \[0-9\]* is inside this variable.*" }