subsumes should check for loops (Ulrich's #146).
This commit is contained in:
parent
b7646836b6
commit
7b85efff0c
@ -2542,6 +2542,7 @@ p_variant(void) /* variant terms t1 and t2 */
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
|
static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
|
||||||
CELL *pt1)
|
CELL *pt1)
|
||||||
{
|
{
|
||||||
@ -2601,6 +2602,8 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
|
|||||||
Bind_Global(pt0, new);
|
Bind_Global(pt0, new);
|
||||||
if (d0 != d1) { /* avoid loops */
|
if (d0 != d1) { /* avoid loops */
|
||||||
Bind_Global(VarOfTerm(new), d1);
|
Bind_Global(VarOfTerm(new), d1);
|
||||||
|
if (Yap_rational_tree_loop(VarOfTerm(new)-1,VarOfTerm(new),(CELL **)AuxSp,(CELL **)AuxBase))
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d0 == d1) continue;
|
if (d0 == d1) continue;
|
||||||
@ -2759,7 +2762,9 @@ p_subsumes(void) /* subsumes terms t1 and t2 */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
if (IsVarTerm(t1)) {
|
if (IsVarTerm(t1)) {
|
||||||
Bind(VarOfTerm(t1), t2);
|
Bind(VarOfTerm(t1), t2);
|
||||||
return(TRUE);
|
if (Yap_rational_tree_loop(VarOfTerm(t1)-1,VarOfTerm(t1),(CELL **)AuxSp,(CELL **)AuxBase))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
} else if (IsVarTerm(t2))
|
} else if (IsVarTerm(t2))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
if (IsAtomOrIntTerm(t1)) {
|
if (IsAtomOrIntTerm(t1)) {
|
||||||
|
Reference in New Issue
Block a user