From 75667d76490c917c87978a7ea38f109fe289ea00 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 1 Nov 2013 15:09:20 +0900 Subject: [PATCH] [bugfix] push nil_value even if ci->argc equals varg proc's argc --- src/vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vm.c b/src/vm.c index d5bb57f8..755d59b3 100644 --- a/src/vm.c +++ b/src/vm.c @@ -337,7 +337,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv) pic->errmsg = "wrong number of arguments"; goto L_RAISE; } - /* prepare rest args */ + } + /* prepare rest args */ + if (proc->u.irep->varg) { rest = pic_nil_value(); for (i = 0; i < ci->argc - proc->u.irep->argc; ++i) { pic_gc_protect(pic, v = POP()); @@ -372,6 +374,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv) pic->sp = pic->ci->fp + argc; pc = POPCI()->pc; + /* c is not changed */ goto L_CALL; } CASE(OP_RET) {