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 | skip(')'); | 4922 | skip(')'); |
| 4923 | a = gvtst(1, 0); | 4923 | a = gvtst(1, 0); |
| 4924 | b = 0; | 4924 | b = 0; |
| 4925 | ++local_scope; | ||
| 4925 | block(&a, &b, case_sym, def_sym, case_reg, 0); | 4926 | block(&a, &b, case_sym, def_sym, case_reg, 0); |
| 4927 | --local_scope; | ||
| 4926 | if(!nocode_wanted) | 4928 | if(!nocode_wanted) |
| 4927 | gjmp_addr(d); | 4929 | gjmp_addr(d); |
| 4928 | gsym(a); | 4930 | gsym(a); |
| @@ -5060,7 +5062,9 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 131 unmodified lines | |||
| 5060 | vtop--; /* NOT vpop() because on x86 it would flush the fp stack */ | 5062 | vtop--; /* NOT vpop() because on x86 it would flush the fp stack */ |
| 5061 | } | 5063 | } |
| 5062 | skip(';'); | 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 | } else if (tok == TOK_BREAK) { | 5068 | } else if (tok == TOK_BREAK) { |
| 5065 | /* compute jump */ | 5069 | /* compute jump */ |
| 5066 | if (!bsym) | 5070 | if (!bsym) |