[bugfix] rhs of assignment may modify lhs pointer
This commit is contained in:
parent
c7f3346be6
commit
8039ddf9c5
4
src/vm.c
4
src/vm.c
|
@ -775,9 +775,11 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
ci->fp = pic->sp - c.u.i;
|
ci->fp = pic->sp - c.u.i;
|
||||||
ci->env = NULL;
|
ci->env = NULL;
|
||||||
if (pic_proc_func_p(pic_proc_ptr(x))) {
|
if (pic_proc_func_p(pic_proc_ptr(x))) {
|
||||||
|
pic_value *sp;
|
||||||
|
|
||||||
/* invoke! */
|
/* invoke! */
|
||||||
pic->sp[0] = proc->u.func.f(pic);
|
sp = pic->sp;
|
||||||
|
sp[0] = proc->u.func.f(pic);
|
||||||
pic->sp += pic->ci->retc;
|
pic->sp += pic->ci->retc;
|
||||||
|
|
||||||
pic_gc_arena_restore(pic, ai);
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
|
Loading…
Reference in New Issue