The back end functions gen_op(comparison) and gtst() might allocate registers so case_reg should be left on the value stack while they are called and set again afterwards.
Unified · Split
| @@ -4883,6 +4883,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 4882 unmodified lines | ||
| 4883 | 4883 | b = gjmp(0); |
| 4884 | 4884 | gsym(*case_sym); |
| 4885 | 4885 | vseti(case_reg, 0); |
| 4886 | + vdup(); | |
| 4886 | 4887 | vpushi(v1); |
| 4887 | 4888 | if (v1 == v2) { |
| 4888 | 4889 | gen_op(TOK_EQ); |
| @@ -4895,6 +4896,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 6 unmodified lines | ||
| 4895 | 4896 | gen_op(TOK_LE); |
| 4896 | 4897 | *case_sym = gtst(1, *case_sym); |
| 4897 | 4898 | } |
| 4899 | + case_reg = gv(RC_INT); | |
| 4900 | + vpop(); | |
| 4898 | 4901 | gsym(b); |
| 4899 | 4902 | skip(':'); |
| 4900 | 4903 | is_expr = 0; |