Bug Report GMP-5.1.1 Mini-gmp t-double.c

Niels Möller nisse at lysator.liu.se
Mon Feb 25 14:45:19 CET 2013


Michael Tate <michael.tate at wanadoo.fr> writes:

> ./config.guess:
> atom-pc-linux-gnu

32-bit, I right?

> Outline:
> Running 'make check' in mini-gmp/tests produces an error in t-double.c
> Partial output follows:
> PASS: t-add
> PASS: t-sub
> PASS: t-mul
> PASS: t-invert
> PASS: t-div
> PASS: t-div_2exp
> mpz_cmp_d (x, f) failed:
> x: 87f41fe00000000
> memory clobbered before allocated block
> ./run-tests: line 57:  4383 Aborted                 (core dumped) "$1"

That *looks* like a serious problem, not just a problem in the test
program. If you can get more information, using valgrind or setting
glibc's MALLOC_CHECK_ and examining the backtrace, that could be
helpful.

I'll also try to reproduce it on x86_32.

> I believe I have found the cause of this problem. The test program
> increments/decrements a double by 1.0 during the course of testing. If
> the double has more than 16 digits of precision, then the inc/dec fails
> to take effect and the succeeding test fails.

The testcode is intended to handle both cases: when the increment has
effect, and when it hasn't. That's why there are some comparisons
between f and d after the increment. Could still be buggy, of course,
but I see no reason why precision-related bugs there should lead to
memory coruption.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list