fix invalid memory access
This commit is contained in:
parent
22f71d7e56
commit
0d5313a063
2
ir.c
2
ir.c
@ -143,7 +143,7 @@ void optimize_ir(IRToks *v) {
|
|||||||
case IRJmp: {
|
case IRJmp: {
|
||||||
/* resolve jump chains (esp. produced by if-else-if... statements) */
|
/* resolve jump chains (esp. produced by if-else-if... statements) */
|
||||||
size_t ja = i;
|
size_t ja = i;
|
||||||
while (v->toks[ja].instr == IRJmp)
|
while (ja < v->len && v->toks[ja].instr == IRJmp)
|
||||||
ja = v->toks[ja].Jmp.iaddr;
|
ja = v->toks[ja].Jmp.iaddr;
|
||||||
v->toks[i].Jmp.iaddr = ja;
|
v->toks[i].Jmp.iaddr = ja;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user