Introduce tests for -fsanitize-address-use-after-scope
[platform/upstream/linaro-gcc.git] / gcc / testsuite / gcc.dg / asan / use-after-scope-goto-2.c
1 // { dg-do run }
2 // { dg-additional-options "-fdump-tree-asan0" }
3 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
4
5 int main(int argc, char **argv)
6 {
7   int a = 123;
8
9   if (argc == 0)
10   {
11     int *ptr;
12     /* The label is not used in &label or goto label.  Thus '&a' should be
13        marked just once.  */
14     label:
15       {
16         ptr = &a;
17         *ptr = 1;
18         return 0;
19       }
20   }
21
22   return 0;
23 }
24
25 /* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, 4\\);" 1 "asan0" } }  */