From 1a9244bce201514fc6eb91a6353119e2118b19ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 11 Jan 2012 13:27:25 +0000 Subject: [PATCH] fix bug in infinite lists. --- C/dbase.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/C/dbase.c b/C/dbase.c index 9b2d748c7..87d3bee2b 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -663,7 +663,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, /* we will need to link afterwards */ ap2 = RepAppl(d0); #ifdef RATIONAL_TREES - if (ap2 >= tbase && ap2 < StoPoint) { + if (ap2 >= tbase && ap2 <= StoPoint) { db_check_trail(dbg->lr+1); *dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase)); *StoPoint++ = d0; @@ -759,10 +759,10 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, else if (IsPairTerm(d0)) { /* we will need to link afterwards */ CELL *ap2 = RepPair(d0); - if (ap2 >= tbase && ap2 < StoPoint) { - *StoPoint++ = d0; + if (ap2 >= tbase && ap2 <= StoPoint) { db_check_trail(dbg->lr+1); *dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase)); + *StoPoint++ = d0; ++pt0; continue; } @@ -786,7 +786,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, do { lp = RepPair(tt); - if (lp >= tbase && lp < StoPoint) { + if (lp >= tbase && lp <= StoPoint) { break; } CheckDBOverflow(2); @@ -801,7 +801,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, IsPairTerm(tt) && /* have same direction to avoid infinite terms X = [a|X] */ (RepPair(tt)-lp)*direction > 0); - if (lp >= tbase && lp < StoPoint) { + if (lp >= tbase && lp <= StoPoint) { CodeMax[-1] = tt; break; }