fix empty slots in unnumbervars.

This commit is contained in:
Vítor Santos Costa 2011-11-18 22:16:33 +00:00
parent e33712403f
commit 749a5103a1

View File

@ -4514,17 +4514,27 @@ unnumber_complex_term(CELL *pt0, CELL *pt0_end, CELL *ptf, CELL *HLow, int share
if (ASP-(max+1) <= H) { if (ASP-(max+1) <= H) {
goto overflow; goto overflow;
} }
/* we found this before */ /* we found this before? */
*ptf++ = ASP[-id-1]; if (ASP[-id-1])
*ptf++ = ASP[-id-1];
else {
RESET_VARIABLE(ptf);
ASP[-id-1] = (CELL)ptf;
ptf++;
}
continue; continue;
} }
max = id; /* alloc more space */
if (ASP-(max+1) <= H) { if (ASP-(id+1) <= H) {
goto overflow; goto overflow;
} }
while (id > max) {
ASP[-(id+1)] = 0L;
max++;
}
/* new variable */ /* new variable */
RESET_VARIABLE(ptf); RESET_VARIABLE(ptf);
ASP[-id-1] = (CELL)ptf; ASP[-(id+1)] = (CELL)ptf;
ptf++; ptf++;
continue; continue;
} }