From 59e103794e793682eb431349280fb62871e9ba9e Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 23 Jun 2008 15:23:12 +0000 Subject: * compile.c (iseq_build_from_ary): initialize arg_opts, a patch from Adam Strzelecki in [ruby-core:17220]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index f0a35a9814..d257072b1b 100644 --- a/compile.c +++ b/compile.c @@ -5019,7 +5019,8 @@ iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, iseq->arg_post_len = FIX2INT(arg_post_len); iseq->arg_post_start = FIX2INT(arg_post_start); iseq->arg_block = FIX2INT(arg_block); - iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, RARRAY_LEN(arg_opt_labels)); + iseq->arg_opts = RARRAY_LEN(arg_opt_labels); + iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, iseq->arg_opts); if (iseq->arg_block != -1) { iseq->arg_size = iseq->arg_block + 1; @@ -5031,7 +5032,7 @@ iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, iseq->arg_size = iseq->arg_rest + 1; } else { - iseq->arg_size = iseq->argc + iseq->arg_opts; + iseq->arg_size = iseq->argc + (iseq->arg_opts ? iseq->arg_opts - 1 : 0); } for (i=0; i