gcc/testsuite/gcc.dg/asan/use-after-scope-switch-4.c
raw| 1 | // { dg-do run } |
| 2 | // { dg-additional-options "-fdump-tree-gimple" } |
| 3 | |
| 4 | int *ptr; |
| 5 | |
| 6 | struct a |
| 7 | { |
| 8 | int c; |
| 9 | }; |
| 10 | |
| 11 | int main(int argc, char **argv) |
| 12 | { |
| 13 | struct a e; |
| 14 | e.c = 2; |
| 15 | int x = 0; |
| 16 | |
| 17 | for (;;) |
| 18 | switch (e.c) |
| 19 | case 3: |
| 20 | { |
| 21 | int resxxx; |
| 22 | case 2: |
| 23 | ptr = &resxxx; |
| 24 | *ptr = 123; |
| 25 | |
| 26 | if (x) |
| 27 | return 0; |
| 28 | else |
| 29 | x = 1; |
| 30 | } |
| 31 | |
| 32 | return 1; |
| 33 | } |
| 34 | |
| 35 | /* { dg-final { scan-tree-dump-times "ASAN_MARK \\(UNPOISON, &resxxx, \[0-9\]\\);" 2 "gimple" } } */ |