Douglas Gregor | fa7b8ce | 2011-03-24 10:35:39 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Douglas Gregor | fa7b8ce | 2011-03-24 10:35:39 +0000 | [diff] [blame] | 3 | |
| 4 | //PR9463 |
| 5 | int subfun(const char *text) { |
| 6 | const char *tmp = text; |
| 7 | return 0; |
| 8 | } |
| 9 | |
| 10 | void fun(const char* text) { |
| 11 | int count = 0; |
| 12 | bool check = true; |
| 13 | |
| 14 | if (check) |
| 15 | { |
| 16 | const char *end = text; |
| 17 | |
| 18 | if (check) |
| 19 | { |
| 20 | do |
| 21 | { |
| 22 | if (check) |
| 23 | { |
| 24 | count = subfun(end); |
| 25 | goto end; |
| 26 | } |
| 27 | |
| 28 | check = !check; |
| 29 | } |
| 30 | while (check); |
| 31 | } |
| 32 | // also works, after commenting following line of source code |
| 33 | int e = subfun(end); |
| 34 | } |
| 35 | end: |
| 36 | if (check) |
| 37 | ++count; |
| 38 | } |
| 39 | |
| 40 | const char *text = "some text"; |
| 41 | |
| 42 | int main() { |
| 43 | const char *ptr = text; |
| 44 | |
| 45 | fun(ptr); |
| 46 | |
| 47 | return 0; |
| 48 | } |