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
4883 b = gjmp(0);4883 b = gjmp(0);
4884 gsym(*case_sym);4884 gsym(*case_sym);
4885 vseti(case_reg, 0);4885 vseti(case_reg, 0);
4886 vdup();
4886 vpushi(v1);4887 vpushi(v1);
4887 if (v1 == v2) {4888 if (v1 == v2) {
4888 gen_op(TOK_EQ);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 gen_op(TOK_LE);4896 gen_op(TOK_LE);
4896 *case_sym = gtst(1, *case_sym);4897 *case_sym = gtst(1, *case_sym);
4897 }4898 }
4899 case_reg = gv(RC_INT);
4900 vpop();
4898 gsym(b);4901 gsym(b);
4899 skip(':');4902 skip(':');
4900 is_expr = 0;4903 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