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

parent eab894e5
...@@ -1114,12 +1114,18 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -1114,12 +1114,18 @@ codegen(codegen_scope *s, node *tree, int val)
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();
} }
else {
dispatch(s, pos1); dispatch(s, pos1);
} }
} }
}
break; break;
case NODE_AND: case NODE_AND:
......
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