> < ^ Date: Thu, 01 Feb 1996 00:18:40 -0800
> ^ From: Matthew Johnson <mejohnsn@netcom.com >
^ Subject: Help with GAP Bug?

Dear Fellow GAP users:
I have ported GAP to Windows NT, which port is not quite ready for returning
to Martin to be included in his revision control system. However, the
following bug also appears under the Mac and NextStep builds of the same
version of the kernel and relevant libraries. The bug is largely explained
in the comments of the code, but I will say here that removing the call to
IsPrimeInt() makes the problem go away; I will also say that the crash
may appear with a quite different error message if any other code is
added to the loop or if run under the Mac or NextStep versions: under
NextStep (a GUI-enhanced MACH UNIX) I usually get a "Segmentation Fault",
under NT I usually get a "STack Overflow" (but occasionally as in
NExtStep), under MacOS 7.5 I get Segmentation Fault.

Thus I am pretty sure that the problem is not in the NT port. The NT
port does have the advantage that NT has at least _some_ debugging tools,
although they are not that helpful with an interpreted program, like a
GAP program.

One peculiarity that may have something to do with the NT port: following the
DOS tradition, STDERR is unbuffered, with a separate handle from STDOUT even
when both point to the same physical device. So I am not sure that the
comment below about the error output taking place during output of the final
fibonacci number is really significant.

Matthew Johnson
Firepower Systems
Menlo Park California

# fibonacci numbers
# This program computes Fibonacci numbers and culls the same for primes.

# With the call to IsPrimeInt, this program crashes on the 2971st Fibonacci number
# All I have been able to find with my primitive tools is that the function call stack
# is filled with repetitive calls to a EvFunccall (apparently to evaluate IsPrimeInt itself)
# after which the exception is generated on a call to NewBag()
# Oh yes, running with the '-g' option shows this crash occurs during/after garbage
# collection, which in turn takes place before the last Fibonacci number has been
# entirely printed out.

# Use the following for recursive computation of F(n)
i := 3;

g := 1;
fib := [1, 1, 2];
while i<2972 do         # On NT crashes on 2971
        j := 1;
        nfib := fib[i] + fib[i-1];
        Add(fib, nfib );
        Print("\nfib[",i+1,"] = ", fib[i+1]);
        test := IsPrimeInt(nfib);          # the failure appears to be here
        if test = true then
                Print("\n\tIsPrimeInt = TRUE");
        i := i+1;

> < [top]