See adjusted testcase, a lone break; in a do while loop was incorrectly disabling the exit test.
Unified · Split
| @@ -6088,6 +6088,8 @@ static void block(int *bsym, int *csym, int is_expr) · 6087 unmodified lines | |||
| 6088 | skip(TOK_WHILE); | 6088 | skip(TOK_WHILE); |
| 6089 | skip('('); | 6089 | skip('('); |
| 6090 | gsym(b); | 6090 | gsym(b); |
| 6091 | if (b) | ||
| 6092 | nocode_wanted = saved_nocode_wanted; | ||
| 6091 | gexpr(); | 6093 | gexpr(); |
| 6092 | c = gvtst(0, 0); | 6094 | c = gvtst(0, 0); |
| 6093 | gsym_addr(c, d); | 6095 | gsym_addr(c, d); |
| @@ -26,6 +26,36 @@ static void kb_wait_1(void) · 25 unmodified lines | |||
| 26 | timeout--; | 26 | timeout--; |
| 27 | } while (timeout); | 27 | } while (timeout); |
| 28 | } | 28 | } |
| 29 | |||
| 30 | static int global; | ||
| 31 | |||
| 32 | static void foo(int i) | ||
| 33 | { | ||
| 34 | global+=i; | ||
| 35 | printf ("g=%d\n", global); | ||
| 36 | } | ||
| 37 | |||
| 38 | static int check(void) | ||
| 39 | { | ||
| 40 | printf ("check %d\n", global); | ||
| 41 | return 1; | ||
| 42 | } | ||
| 43 | |||
| 44 | static void dowhile(void) | ||
| 45 | { | ||
| 46 | do { | ||
| 47 | foo(1); | ||
| 48 | if (global == 1) { | ||
| 49 | continue; | ||
| 50 | } else if (global == 2) { | ||
| 51 | continue; | ||
| 52 | } | ||
| 53 | /* The following break shouldn't disable the check() call, | ||
| 54 | as it's reachable by the continues above. */ | ||
| 55 | break; | ||
| 56 | } while (check()); | ||
| 57 | } | ||
| 58 | |||
| 29 | int main (void) | 59 | int main (void) |
| 30 | { | 60 | { |
| 31 | int i = 1; | 61 | int i = 1; |
| @@ -118,5 +148,8 @@ enterloop3: · 86 unmodified lines | |||
| 118 | printf ("error4\n"); | 148 | printf ("error4\n"); |
| 119 | } | 149 | } |
| 120 | } | 150 | } |
| 151 | |||
| 152 | dowhile(); | ||
| 153 | |||
| 121 | return 0; | 154 | return 0; |
| 122 | } | 155 | } |
| @@ -16,3 +16,8 @@ once3 · 15 unmodified lines | |||
| 16 | twice3 | 16 | twice3 |
| 17 | caseok | 17 | caseok |
| 18 | caseok2 | 18 | caseok2 |
| 19 | g=1 | ||
| 20 | check 1 | ||
| 21 | g=2 | ||
| 22 | check 2 | ||
| 23 | g=3 | ||