From 5296cadde26219d210682ef2b9e0c2588a8ec83a Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Mon, 5 Aug 2019 15:18:22 +0000 Subject: [PATCH] fixed a bug of not skipping a goto struct with its ip set to INVALID_IP in adjust_all_gotos_for_elimination() --- moo/lib/comp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 91964d5..a76759f 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -2865,15 +2865,18 @@ static MOO_INLINE void adjust_all_gotos_for_elimination (moo_t* moo, moo_oow_t s _goto = cc->mth._goto; while (_goto) { - if (_goto->ip >= start && _goto->ip <= end) + if (_goto->ip != INVALID_IP) { - /* invalidate this entry since the goto instruction itself is getting eliminated. - * i don't kill this node. the resolver must skip this node. */ - _goto->ip = INVALID_IP; - } - else if (_goto->ip > end) - { - _goto->ip -= end - start + 1; + if (_goto->ip >= start && _goto->ip <= end) + { + /* invalidate this entry since the goto instruction itself is getting eliminated. + * i don't kill this node. the resolver must skip this node. */ + _goto->ip = INVALID_IP; + } + else if (_goto->ip > end) + { + _goto->ip -= end - start + 1; + } } _goto = _goto->next; @@ -5110,7 +5113,6 @@ moo_oow_t pop_stacktop_pos = INVALID_IP; /* TODO: move this up */ } else if (TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD) { - moo_ioloc_t period_loc = *TOKEN_LOC(moo); GET_TOKEN (moo); if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACK) {