Page 1 of 1
Bug in GMP module?
Posted: Mon Dec 14, 2009 10:36 am
by TedWalther
For the last few releases, I've gotten segmentation faults on 64 bit Ubuntu and 64 bit OpenBSD. Haven't tested on 32 bit, no hardware to test on. Am using libgmp version 3.5.0
The bug is a segfault whenever I try to factor a non-prime number using GMP.
To duplicate the bug, do this:
Code: Select all
(module "gmp.lsp")
(GMP:factor "4")
I narrowed the segfault down to this line of code in the push-factor function in the gmp module:
Code: Select all
(set 'f (get-string (__gmpz_get_str rops 10 f)))
Re: Bug in GMP module?
Posted: Mon Dec 14, 2009 11:44 am
by Lutz
What happens when you run (test-GMP) ? I ran it fine a few months back on your OpenBSD machine, and it was fine on 64-bit, but never have tested on 64-bit UBUNTU. The test also checks the factor method.
I could check it out, but I am travelling and don't have the address of your machine with me, although I remember user-id and password. Perhaps you can email me the machine address again and I can look at it too?
Re: Bug in GMP module?
Posted: Mon Dec 14, 2009 2:52 pm
by TedWalther
Code: Select all
> (test-GMP)
GMP:+ -> Ok
GMP:- -> Ok
GMP:* -> Ok
GMP:/ -> Ok
GMP:% -> Ok
GMP:** -> Ok
GMP:= -> Ok
Problem in GMP:<
Problem in GMP:>
Problem in GMP:<=
Problem in GMP:>=
GMP:& -> Ok
GMP:| -> Ok
GMP:^ -> Ok
GMP:~ -> Ok
GMP:prime? -> Ok
GMP:next-prime -> Ok
Problem in GMP:factor
GMP:gcd -> Ok
GMP:bin -> Ok
GMP:fac -> Ok
GMP:fib -> Ok
GMP:seed -> Ok
"\t-> Ok"
>
It didn't segfault. Odd.
On OpenBSD, I am using libgmp.so.8.0
On Ubuntu, I am using libgmp.so.3.5.0
Exact same results of (test-GMP) for both.
Re: Bug in GMP module?
Posted: Tue Dec 15, 2009 12:19 am
by Lutz
There is a new development/latest/newlisp-10.1.9-dev.tgz fixing gmp.lsp. Note that the fix is in both, the newLISP binary and the module file gmp.lsp. Both are sign-extension fixes for 64-bit mode. Ted: that package is already on your m4, where I tested it.
Re: Bug in GMP module?
Posted: Tue Dec 15, 2009 1:05 am
by TedWalther
On Ubuntu, the comparison tests now pass, but factor still bombs out on the same line of code, despite the int32's sprinkled in it.
Code: Select all
> (test-GMP)
GMP:+ -> Ok
GMP:- -> Ok
GMP:* -> Ok
GMP:/ -> Ok
GMP:% -> Ok
GMP:** -> Ok
GMP:= -> Ok
GMP:< -> Ok
GMP:> -> Ok
GMP:<= -> Ok
GMP:>= -> Ok
GMP:& -> Ok
GMP:| -> Ok
GMP:^ -> Ok
GMP:~ -> Ok
GMP:prime? -> Ok
GMP:next-prime -> Ok
Segmentation fault