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) {
goto overflow;
}
/* we found this before */
*ptf++ = ASP[-id-1];
/* we found this before? */
if (ASP[-id-1])
*ptf++ = ASP[-id-1];
else {
RESET_VARIABLE(ptf);
ASP[-id-1] = (CELL)ptf;
ptf++;
}
continue;
}
max = id;
if (ASP-(max+1) <= H) {
/* alloc more space */
if (ASP-(id+1) <= H) {
goto overflow;
}
while (id > max) {
ASP[-(id+1)] = 0L;
max++;
}
/* new variable */
RESET_VARIABLE(ptf);
ASP[-id-1] = (CELL)ptf;
ASP[-(id+1)] = (CELL)ptf;
ptf++;
continue;
}