Okay... a real bug
Stephen Weeks
MLton@research.nj.nec.com
Wed, 23 Feb 2000 20:40:30 -0800 (PST)
> Segfaults.... it just computes the sum of the first 100 integers.. I think
> this is a stack resize bug...
Yes indeed. There are two fencepost bugs (essentially the same) in
the stack limit check. In machine.h, StackOverflowCheck should be
defined as
#define StackOverflowCheck (stackTop >= gcState.stackLimit)
And, in gc.c, stackTopIsOk should be defined as
static bool stackTopIsOk(GC_state s, GC_stack stack) {
return stackTop(stack) < stackLimit(s, stack) + topFrameSize(s, stack);
}
With these two fixes, the program prints out 5051 (i.e. 1 + the sum of
the first 100 integers, which what I think your code is doing). I
hope this fixes the problem, and keep those bug reports coming.