fixed the wrong assertion in find_variable_backward() in comp.c

This commit is contained in:
hyung-hwan 2021-11-21 16:16:59 +00:00
parent 4a0ecfa0f1
commit 6d9f2cc91a

View File

@ -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_oow_t i, index;
hcl_oocs_t haystack; 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 /* 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 */ * to avoid an extra exit check without it */
for (i = hcl->c->fnblk.depth + 1; i > 0; ) for (i = hcl->c->fnblk.depth + 1; i > 0; )
{ {
fbi = &hcl->c->fnblk.info[--i]; fbi = &hcl->c->fnblk.info[--i];
if (i > 0) if (HCL_LIKELY(i > 0))
{ {
parent_tmprlen = hcl->c->fnblk.info[i - 1].tmprlen; parent_tmprlen = hcl->c->fnblk.info[i - 1].tmprlen;
parent_tmprcnt = hcl->c->fnblk.info[i - 1].tmprcnt; parent_tmprcnt = hcl->c->fnblk.info[i - 1].tmprcnt;