Fixes: sometimes entered panic mode with wrong fakestack
This commit is contained in:
parent
da84cc69bc
commit
c34fcda208
1 changed files with 7 additions and 4 deletions
|
@ -39,7 +39,7 @@ string ad2str();
|
||||||
#define DEBUG(string) {if(Debug) fprintf(stderr,"%-*d%s\n",4*level,level,string);}
|
#define DEBUG(string) {if(Debug) fprintf(stderr,"%-*d%s\n",4*level,level,string);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BROKE() {assert(origcp!=startupcode);DEBUG("BROKE");totalcost=INFINITY;goto doreturn;}
|
#define BROKE() {assert(origcp!=startupcode || !paniced);DEBUG("BROKE");totalcost=INFINITY;goto doreturn;}
|
||||||
#define CHKCOST() {if (totalcost>=costlimit) BROKE();}
|
#define CHKCOST() {if (totalcost>=costlimit) BROKE();}
|
||||||
|
|
||||||
#ifdef TABLEDEBUG
|
#ifdef TABLEDEBUG
|
||||||
|
@ -179,7 +179,7 @@ if (Debug)
|
||||||
if (dist<mindistance) {
|
if (dist<mindistance) {
|
||||||
if(dist==0)
|
if(dist==0)
|
||||||
goto gotit;
|
goto gotit;
|
||||||
if (! paniced) npos=0;
|
npos=0;
|
||||||
mindistance = dist;
|
mindistance = dist;
|
||||||
}
|
}
|
||||||
#ifdef ALLOW_NEXTEM
|
#ifdef ALLOW_NEXTEM
|
||||||
|
@ -430,11 +430,11 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
|
||||||
myfree((string)besttup);
|
myfree((string)besttup);
|
||||||
normalfailed: if (stackpad!=tokpatlen) {
|
normalfailed: if (stackpad!=tokpatlen) {
|
||||||
if (stackpad) {
|
if (stackpad) {
|
||||||
if (costlimit<MAXINT)
|
|
||||||
BROKE();
|
|
||||||
for (i=0;i<stackheight-stackpad;i++)
|
for (i=0;i<stackheight-stackpad;i++)
|
||||||
fakestack[i] = fakestack[i+stackpad];
|
fakestack[i] = fakestack[i+stackpad];
|
||||||
stackheight -= stackpad;
|
stackheight -= stackpad;
|
||||||
|
if (costlimit<MAXINT)
|
||||||
|
BROKE();
|
||||||
totalcost += stackupto(&fakestack[stackheight-1],ply,toplevel);
|
totalcost += stackupto(&fakestack[stackheight-1],ply,toplevel);
|
||||||
} else
|
} else
|
||||||
totalcost += stackupto(fakestack,ply,toplevel);
|
totalcost += stackupto(fakestack,ply,toplevel);
|
||||||
|
@ -442,6 +442,9 @@ normalfailed: if (stackpad!=tokpatlen) {
|
||||||
goto nextmatch;
|
goto nextmatch;
|
||||||
}
|
}
|
||||||
totalcost += mincost;
|
totalcost += mincost;
|
||||||
|
for (i=0;i<stackheight-stackpad;i++)
|
||||||
|
fakestack[i] = fakestack[i+stackpad];
|
||||||
|
stackheight -= stackpad;
|
||||||
BROKE();
|
BROKE();
|
||||||
}
|
}
|
||||||
for (i=0;i<nregneeded;i++)
|
for (i=0;i<nregneeded;i++)
|
||||||
|
|
Loading…
Add table
Reference in a new issue