jump address error when value taken from if statement without else clause; close #712

parent eab894e5
...@@ -1106,18 +1106,24 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -1106,18 +1106,24 @@ codegen(codegen_scope *s, node *tree, int val)
if (e) { if (e) {
if (val) pop(); if (val) pop();
pos2 = new_label(s); pos2 = new_label(s);
genop(s, MKOP_sBx(OP_JMP, 0)); genop(s, MKOP_sBx(OP_JMP, 0));
dispatch(s, pos1); dispatch(s, pos1);
codegen(s, e, val); codegen(s, e, val);
dispatch(s, pos2); dispatch(s, pos2);
} }
else { else {
if (val) { if (val) {
pop(); pop();
pos2 = new_label(s);
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch(s, pos1);
genop(s, MKOP_A(OP_LOADNIL, cursp())); genop(s, MKOP_A(OP_LOADNIL, cursp()));
dispatch(s, pos2);
push(); push();
} }
dispatch(s, pos1); else {
dispatch(s, pos1);
}
} }
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment