When 'return' is the last statement of the top-level block (very common and often recommended case) jump is not needed.
Unified · Split
| @@ -4922,7 +4922,9 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 4921 unmodified lines | ||
| 4922 | 4922 | skip(')'); |
| 4923 | 4923 | a = gvtst(1, 0); |
| 4924 | 4924 | b = 0; |
| 4925 | + ++local_scope; | |
| 4925 | 4926 | block(&a, &b, case_sym, def_sym, case_reg, 0); |
| 4927 | + --local_scope; | |
| 4926 | 4928 | if(!nocode_wanted) |
| 4927 | 4929 | gjmp_addr(d); |
| 4928 | 4930 | gsym(a); |
| @@ -5060,7 +5062,9 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 131 unmodified lines | ||
| 5060 | 5062 | vtop--; /* NOT vpop() because on x86 it would flush the fp stack */ |
| 5061 | 5063 | } |
| 5062 | 5064 | skip(';'); |
| 5063 | − rsym = gjmp(rsym); /* jmp */ | |
| 5065 | + /* jump unless last stmt in top-level block */ | |
| 5066 | + if (tok != '}' || local_scope != 1) | |
| 5067 | + rsym = gjmp(rsym); | |
| 5064 | 5068 | } else if (tok == TOK_BREAK) { |
| 5065 | 5069 | /* compute jump */ |
| 5066 | 5070 | if (!bsym) |