David Newman david.newman at
Sun May 2 17:17:25 CEST 2004

Kevin Ryde wrote:
> David Newman <david.newman at> writes:
>>Ah...  no I'm not, take x = 4. It's a Debian system, running
>>libc6 2.2.5-11.5
>>gcc version 2.95.4 20011002 (Debian prerelease)
> That sounds like a sensible setup.  You'll have to trace through what
> seems to be going wrong.  That test program doesn't give much
> diagnostics, so add some printfs, see if it seems to be particular
> data values, and try to trace through where it first goes wrong.

The error seems to be in the subtraction. When computing (a+b)-b, we 
sometimes get the two's complement or the negated two's complement of a. 
And sometimes mpz/t-addsub bombs out with "Illegal instruction" or 

I cannot reproduce any instance of (a+b)-b != a by putting the code in 
a separate file so I reckon it's some kind of memory problem, maybe a 
old/buggy binutils or glibc. The test runs fine if I disable all asm 
code (but keep '-O3 -g -march=pentium -fomit-frame-pointer')

More information about the gmp-devel mailing list