Hello nhc-bugs,
Using nhc98-1.16 to experiment with some number-theoretic
computations (c.f. H. W. Lenstra: "Factoring integers with elliptic
curves", Annals of Math., 126 (1987), 649-673), I ran into a
"Segmentation fault" and also examples of inconsistent Integer
computations. The result of executing the same program varies with
the size of the heap (the +RTS -H<size> option).
I have reduced the size of the original program and attached the
resulting t5.hs. Using the also attached t5.sh, the program is
compiled and executed three times with varying heap size and with
three different outcomes: Segmentation fault, wrong result, OK
result. The OK result is verified by also running t5.hs with hugs.
The output t5.out of
sh t5.sh >t5.out 2>&1
is also attached.
To attempt to re-create this behaviour, place t5.hs and t5.sh in a
fresh directory, adjust NHC98 and HUGS in t5.sh to point to the
installed nhc98 compiler and hugs interpreter, and run
sh t5.sh
The t5.hs program attempts to factor the square of the Mersenne prime
2^127-1, that happens in the line
putStr ( "t5: " ++ show ( ec 2 ((2^127-1)^2) 50 1 ) ++ "\n" )
of t5.hs. Not a particular useful endeavor, but it suffices to
illustrate the problem. The "50" in this line limits the list of
primes that are used in the elliptic curve method. It may be
possible to reduce this number and get a shorter computation that
illustrates similar problems. I have attempted to use (2^127-1)
instead of ((2^127-1)^2), but failed to illustrate the problem.
The behaviour is apparently consistent, but erratic, depending on the
specified heap size. In the present case, for example, a heap size of
10000 bytes gets the segmentation fault.
The ghc98 that I use is compiled (currently "make basic" only) from
nhc98src-1.16.tar.gz on a Redhat 8.0 Linux.
I would be most grateful to receive some advice on how to proceed in
this matter.
Thanks a lot.
Regards Thorkil