mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
Fix handling of case_reg in switch statement.
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.
This commit is contained in:
parent
a6c3ce6ec0
commit
ff3f9aa6ba
3
tccgen.c
3
tccgen.c
@ -4883,6 +4883,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
||||
b = gjmp(0);
|
||||
gsym(*case_sym);
|
||||
vseti(case_reg, 0);
|
||||
vdup();
|
||||
vpushi(v1);
|
||||
if (v1 == v2) {
|
||||
gen_op(TOK_EQ);
|
||||
@ -4895,6 +4896,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
||||
gen_op(TOK_LE);
|
||||
*case_sym = gtst(1, *case_sym);
|
||||
}
|
||||
case_reg = gv(RC_INT);
|
||||
vpop();
|
||||
gsym(b);
|
||||
skip(':');
|
||||
is_expr = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user