Fixed wrong assertion, and fixed bug in distance routine: it did not check

that each stackpattern token that does not exactly match can be made from the
stack
This commit is contained in:
ceriel 1990-04-04 14:52:29 +00:00
parent ededd15b74
commit 16ef0467a8
2 changed files with 9 additions and 1 deletions

View file

@ -152,7 +152,7 @@ unsigned codegen(codep,ply,toplevel,costlimit,forced) byte *codep; unsigned cost
int j, nargs;
getint(i,bp);
getint(nargs,bp);
assert(nargs < MAXPROCARG);
assert(nargs <= MAXPROCARG);
for (j = 0; j < nargs; j++) {
getint(procarg[j],bp);
}

View file

@ -324,6 +324,14 @@ distance(cindex) {
return(100);
if (expsize<toksize)
return(99-i);
/* Now we have a match in size, but it is not exact.
Therefore, make sure that we can at least
create it from the stack!
*/
if (! from_stack(&machsets[tokexp])) {
return MAXINT;
}
} else
exact++;
}