handle overflow error in YAP_MkPairTerm ( obs from Fabrizio Riguzzi).

This commit is contained in:
Vitor Santos Costa 2009-07-13 21:55:57 -05:00
parent 02e82d7719
commit 11cefa668a

View File

@ -857,11 +857,18 @@ YAP_MkPairTerm(Term t1, Term t2)
Term t;
BACKUP_H();
if (H > ASP-1024)
t = TermNil;
else
t = MkPairTerm(t1, t2);
if (H > ASP-1024) {
long sl1 = Yap_InitSlot(t1);
long sl2 = Yap_InitSlot(t2);
if (!dogc()) {
RECOVER_H();
return TermNil;
}
t1 = Yap_GetFromSlot(sl1);
t2 = Yap_GetFromSlot(sl2);
Yap_RecoverSlots(2);
}
t = MkPairTerm(t1, t2);
RECOVER_H();
return t;
}