better handle over overflow.

This commit is contained in:
Vitor Santos Costa 2010-03-30 12:45:32 +01:00
parent f45e95ba68
commit c4819d8ab2
1 changed files with 4 additions and 1 deletions

View File

@ -543,15 +543,16 @@ static Int
p_put_atts(void) { p_put_atts(void) {
/* receive a variable in ARG1 */ /* receive a variable in ARG1 */
Term inp = Deref(ARG1); Term inp = Deref(ARG1);
Term otatts;
/* if this is unbound, ok */ /* if this is unbound, ok */
if (IsVarTerm(inp)) { if (IsVarTerm(inp)) {
attvar_record *attv; attvar_record *attv;
Term otatts;
Term tatts = Deref(ARG2); Term tatts = Deref(ARG2);
Functor mfun = FunctorOfTerm(tatts); Functor mfun = FunctorOfTerm(tatts);
int new = FALSE; int new = FALSE;
tatts = Deref(ARG2);
if (IsAttachedTerm(inp)) { if (IsAttachedTerm(inp)) {
attv = RepAttVar(VarOfTerm(inp)); attv = RepAttVar(VarOfTerm(inp));
} else { } else {
@ -566,6 +567,8 @@ p_put_atts(void) {
new = TRUE; new = TRUE;
Yap_unify(ARG1, AbsAttVar(attv)); Yap_unify(ARG1, AbsAttVar(attv));
} }
/* we may have a stack shift meanwhile!! */
tatts = Deref(ARG2);
if (IsVarTerm(otatts = SearchAttsForModule(attv->Atts,mfun))) { if (IsVarTerm(otatts = SearchAttsForModule(attv->Atts,mfun))) {
AddNewModule(attv,tatts,new,FALSE); AddNewModule(attv,tatts,new,FALSE);
} else { } else {