From 3c44b0209318a4a1e98da773c2b75158d45e3aa1 Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 8 Sep 2004 19:06:57 +0000 Subject: [PATCH] alwas make sure you are looking at a variable before checking IsUnboundVar git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1130 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/attvar.c | 6 +++--- C/utilpreds.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C/attvar.c b/C/attvar.c index 0480ea445..423b2ad95 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -281,8 +281,8 @@ PutAtt(attvar_record *attv, Int i, Term tatt) { static Int UpdateAtt(attvar_record *attv, Int i, Term tatt) { Int pos = i*2; - - if (!IsUnboundVar(attv->Atts[pos+1])) { + Term tv = attv->Atts[pos+1]; + if (!IsVarTerm(tv) || !IsUnboundVar(tv)) { tatt = MkPairTerm(tatt, attv->Atts[pos+1]); } else { tatt = MkPairTerm(tatt, TermNil); @@ -389,7 +389,7 @@ static Int GetAtt(attvar_record *attv, int i) { Int pos = i *2; #if SBA - if (IsUnboundVar(attv->Atts[pos+1])) + if (IsVarTerm(attv->Atts[pos+1]) && IsUnboundVar(attv->Atts[pos+1])) return((CELL)&(attv->Atts[pos+1])); #endif return(attv->Atts[pos+1]); diff --git a/C/utilpreds.c b/C/utilpreds.c index 6d5bbf741..9c28890ab 100644 --- a/C/utilpreds.c +++ b/C/utilpreds.c @@ -1691,7 +1691,7 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register /* cell we created */ CELL *npt1 = (CELL *)*pt1; /* shorten the chain */ - if (IsUnboundVar(*pt1)) { + if (IsVarTerm(*pt1) && IsUnboundVar(*pt1)) { RESET_VARIABLE(pt1); } else { *pt1 = *npt1;