From 6d9f2cc91a2403600c14a692ace416cd4af0de5d Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 21 Nov 2021 16:16:59 +0000 Subject: [PATCH] fixed the wrong assertion in find_variable_backward() in comp.c --- lib/comp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/comp.c b/lib/comp.c index defa895..c2a2445 100644 --- a/lib/comp.c +++ b/lib/comp.c @@ -267,14 +267,15 @@ static int find_variable_backward (hcl_t* hcl, const hcl_oocs_t* name, var_info_ hcl_oow_t i, index; hcl_oocs_t haystack; - HCL_ASSERT (hcl, hcl->c->fnblk.info[hcl->c->fnblk.depth].tmprlen = hcl->c->tv.s.len); + HCL_ASSERT (hcl, hcl->c->fnblk.depth >= 0); + HCL_ASSERT (hcl, hcl->c->fnblk.info[hcl->c->fnblk.depth].tmprlen == hcl->c->tv.s.len); /* depth begins at -1. so it is the actual index. let the looping begin at depth + 1 * to avoid an extra exit check without it */ for (i = hcl->c->fnblk.depth + 1; i > 0; ) { fbi = &hcl->c->fnblk.info[--i]; - if (i > 0) + if (HCL_LIKELY(i > 0)) { parent_tmprlen = hcl->c->fnblk.info[i - 1].tmprlen; parent_tmprcnt = hcl->c->fnblk.info[i - 1].tmprcnt;