Likely GMP bug

Dennis Clarke dclarke at blastwave.org
Fri May 25 21:02:41 UTC 2018


On 05/25/2018 04:30 PM, Torbjörn Granlund wrote:
> Dennis Clarke <dclarke at blastwave.org> writes:
> 
>    I have run all the testsuite, both with the assembly and without, on a
>    pure 32-bit Debian machine and see no errors anywhere.
> 
> Our machine runs gentoo with gcc 6.4.0.  (Not sure if the exact machine
> matters.)

Debian sid here with a custom minimal kernel and my own gcc 8.1.0 :

phobos$ gcc --version
gcc (genunix Thu May 17 17:47:37 UTC 2018) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

https://gcc.gnu.org/ml/gcc-testresults/2018-05/msg02795.html


> 
> datan$ somepath/gmp/configure CFLAGS="-m32 -g -fsanitize=undefined -fno-sanitize-recover" --disable-shared --disable-assembly ABI=32 && make && make check TESTS= INTERPRETER=)
> 
> datan$ GMP_CHECK_RANDOMIZE=140064609456624 tests/mpq/t-cmp_ui
> gcd_1.c:187:13: runtime error: shift exponent 32 is too large for 32-bit type 'long unsigned int'
> 

Yet another idea here was to disable the gcc builtin functions and
truely be generic.

I will give your test instructions a whirl with what I have on hand and
then go back and do a rebuilt again :


Breakpoint 1, __gmpn_gcd_1 (up=0xbffff6e0, size=1, vlimb=2513224) at 
gcd_1.c:187
187           ulimb >>= (c + 1);
(gdb) print c
$9 = 2
(gdb) print c=31
$10 = 31
(gdb) step
149       while (ulimb != vlimb)
(gdb) cont
Continuing.

Breakpoint 1, __gmpn_gcd_1 (up=0xbffff6e0, size=1, vlimb=2513224) at 
gcd_1.c:187
187           ulimb >>= (c + 1);
(gdb) print c
$11 = 2
(gdb) print c=32
$12 = 32
(gdb) print c
$13 = 32
(gdb) step
149       while (ulimb != vlimb)
(gdb) cont
Continuing.

Breakpoint 1, __gmpn_gcd_1 (up=0xbffff6e0, size=1, vlimb=1897786) at 
gcd_1.c:187
187           ulimb >>= (c + 1);
(gdb) quit

hrmmm .. won't break.

I'll do a rebuild again.


Dennis


More information about the gmp-bugs mailing list