diff --git a/C/unify.c b/C/unify.c index 4e4b7b81d..fa202e011 100644 --- a/C/unify.c +++ b/C/unify.c @@ -36,6 +36,7 @@ int Yap_rational_tree_loop(CELL *pt0, CELL *pt0_end, CELL **to_visit, CELL **to_visit_max) { + CELL ** base = to_visit; rtree_loop: while (pt0 < pt0_end) { register CELL *ptd0; @@ -91,7 +92,7 @@ rtree_loop: derefa_body(d0, ptd0, rtree_loop_unk, rtree_loop_nvar); } /* Do we still have compound terms to visit */ - if (to_visit < (CELL **)to_visit_base) { + if (to_visit < base) { pt0 = to_visit[0]; pt0_end = to_visit[1]; *pt0 = (CELL)to_visit[2]; @@ -102,7 +103,7 @@ rtree_loop: cufail: /* we found an infinite term */ - while (to_visit < (CELL **)to_visit_base) { + while (to_visit < (CELL **)base) { CELL *pt0; pt0 = to_visit[0]; *pt0 = (CELL)to_visit[2];