Bug in GMP module?

Notices and updates
Locked
TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Bug in GMP module?

Post 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)))
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Bug in GMP module?

Post 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?

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Bug in GMP module?

Post 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.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Bug in GMP module?

Post 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.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Bug in GMP module?

Post 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
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Locked