gcc/testsuite/gcc.dg/asan/use-after-scope-11.c
raw| 1 | // { dg-do run } |
| 2 | |
| 3 | #include <string.h> |
| 4 | |
| 5 | char cc; |
| 6 | char ptr[] = "sparta2"; |
| 7 | |
| 8 | void get(char **x) |
| 9 | { |
| 10 | *x = ptr; |
| 11 | } |
| 12 | |
| 13 | int main() |
| 14 | { |
| 15 | char *here = &cc; |
| 16 | |
| 17 | for (;;) |
| 18 | { |
| 19 | next_line: |
| 20 | if (here == NULL) |
| 21 | __builtin_abort(); |
| 22 | get (&here); |
| 23 | if (strcmp (here, "sparta") == 0) |
| 24 | goto next_line; |
| 25 | else if (strcmp (here, "sparta2") == 0) |
| 26 | break; |
| 27 | } |
| 28 | |
| 29 | return 0; |
| 30 | } |