gcc/testsuite/gcc.dg/asan/pr66314.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-std=gnu89 -fprofile-arcs -fno-sanitize=all -fsanitize=kernel-address" } */ |
| 3 | /* { dg-skip-if "" { *-*-* } { "*" } { "-Os" } } */ |
| 4 | |
| 5 | char *a; |
| 6 | int d; |
| 7 | |
| 8 | static int |
| 9 | fn1 (int b, int c) |
| 10 | { |
| 11 | while (a) |
| 12 | if (*a) |
| 13 | return -126; |
| 14 | if (b) |
| 15 | return -12; |
| 16 | if (c == -12) |
| 17 | return c; |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | fn2 (int b, int c) |
| 22 | { |
| 23 | for (;;) |
| 24 | { |
| 25 | d = fn1 (b, c); |
| 26 | switch (d) |
| 27 | { |
| 28 | case -126: |
| 29 | continue; |
| 30 | default: |
| 31 | return; |
| 32 | } |
| 33 | } |
| 34 | } |