Likely GMP bug
Dennis Clarke
dclarke at blastwave.org
Sat May 26 04:19:28 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.)
>
> 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'
>
>
OKay .. same result here :
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.
phobos$ ./configure ABI=32 --enable-cxx --prefix=/usr/local
--libdir=/usr/local/lib --with-gnu-ld --disable-assembly
PASS: t-aors
FAIL: t-cmp
FAIL: t-cmp_ui
PASS: t-cmp_si
PASS: t-equal
PASS: t-get_d
PASS: t-get_str
PASS: t-inp_str
PASS: t-inv
PASS: t-md_2exp
PASS: t-set_f
PASS: t-set_str
PASS: io
PASS: reuse
PASS: t-cmp_z
============================================================================
Testsuite summary for GNU MP 6.1.99
============================================================================
# TOTAL: 15
# PASS: 13
# SKIP: 0
# XFAIL: 0
# FAIL: 2
# XPASS: 0
# ERROR: 0
============================================================================
phobos$ gdb tests/mpq/t-cmp_ui
GNU gdb (Debian 7.12-6+b1) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from tests/mpq/t-cmp_ui...done.
warning: File
"/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/.gdbinit"
auto-loading has been declined by your `auto-load safe-path' set to
"$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path
/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/.gdbinit
line to your configuration file "/home/dclarke/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/dclarke/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the
shell:
info "(gdb)Auto-loading safe path"
(gdb) dir
/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/mpn:/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/mpn/generic
Source directories searched:
/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/mpn:/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/mpn/generic:$cdir:$cwd
(gdb) break gcd_1.c:187
No source file named gcd_1.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (gcd_1.c:187) pending.
(gdb) run
Starting program:
/usr/local/build/gmp-6.1.99-20180525_4.16.4-genunix_i686.003/tests/mpq/t-cmp_ui
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
warning: File "/usr/local/gcc8/lib/libstdc++.so.6.0.25-gdb.py"
auto-loading has been declined by your `auto-load safe-path' set to
"$debugdir:$datadir/auto-load".
Re-seeding with GMP_CHECK_RANDOMIZE=140064609456624
Breakpoint 1, __gmpn_gcd_1 (up=0xbffff690, size=1, vlimb=100580449) at
gcd_1.c:187
187 ulimb >>= (c + 1);
(gdb) print c
$1 = 1
(gdb) print c=30
$2 = 30
(gdb) cont
Continuing.
Breakpoint 1, __gmpn_gcd_1 (up=0xbffff690, size=1, vlimb=0) at gcd_1.c:187
187 ulimb >>= (c + 1);
(gdb) print c=31
$3 = 31
(gdb) frame
#0 __gmpn_gcd_1 (up=0xbffff690, size=1, vlimb=0) at gcd_1.c:187
187 ulimb >>= (c + 1);
(gdb) bt
#0 __gmpn_gcd_1 (up=0xbffff690, size=1, vlimb=0) at gcd_1.c:187
#1 0xb7ec6bef in gcd_2 (gp=0xbffff690, up=0xbffff570, vp=0xbffff6b0) at
gcd.c:129
#2 0xb7ec81c3 in __gmpn_gcd (gp=0xbffff690, up=0xbffff570, usize=4,
vp=0xbffff6b0, n=2) at gcd.c:304
#3 0xb7e600bc in __gmpz_gcd (g=0xbffff7f0, u=0xbffff83c, v=0xbffff848)
at gcd.c:138
#4 0xb7e88ee2 in __gmpq_canonicalize (op=0xbffff83c) at canonicalize.c:54
#5 0x080498bc in main (argc=1, argv=0xbffff924) at t-cmp_ui.c:86
(gdb) cont
Continuing.
gcd_1.c:187:13: runtime error: shift exponent 32 is too large for 32-bit
type 'long unsigned int'
[Inferior 1 (process 11241) exited with code 01]
(gdb) quit
phobos$
Dennis
More information about the gmp-bugs
mailing list