History

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.

Edmund Grimley Evans committed 11 years ago

Commit ff3f9aa1 parent a6c3ce61 file · +3 −0Browse files

Unified · Split

tccgen.c+3−0
@@ -4883,6 +4883,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 4882 unmodified lines
48834883 b = gjmp(0);
48844884 gsym(*case_sym);
48854885 vseti(case_reg, 0);
4886+ vdup();
48864887 vpushi(v1);
48874888 if (v1 == v2) {
48884889 gen_op(TOK_EQ);
@@ -4895,6 +4896,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 6 unmodified lines
48954896 gen_op(TOK_LE);
48964897 *case_sym = gtst(1, *case_sym);
48974898 }
4899+ case_reg = gv(RC_INT);
4900+ vpop();
48984901 gsym(b);
48994902 skip(':');
49004903 is_expr = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t