Source: flint
Version: 2.9.0-5
Severity: normal

Dear Maintainer,

Build fails in testsuite:
cmp_si....cmp_ui....make[3]: *** [../Makefile.subdirs:107: 
../build/fmpq/test/t-cmp_si_RUN] Segmentation fault (core dumped)
make[3]: *** Waiting for unfinished jobs....
PASS
PASS
PASS
make[3]: Leaving directory '/<<PKGBUILDDIR>>/fmpq'
make[2]: *** [Makefile:224: check] Error 2

(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/dave/debian/flint/flint-2.9.0/build/fmpq/test/t-cmp_si
warning: File "/lib/hppa-linux-gnu/libthread_db.so.1" auto-loading has been 
declined by your `auto-load safe-path' set to 
"$debugdir:$datadir/auto-load:/lib/hppa-linux-gnu/libthread_db-1.0.so:/home/dave/debian/firefox/firefox-50.1.0/.gdbinit".
warning: Unable to find libthread_db matching inferior's thread library, thread 
debugging will not be available.
cmp_si....
Program received signal SIGSEGV, Segmentation fault.
0xf900cefc in FLINT_BIT_COUNT (x=<optimized out>) at ./flint.h:355
355        if (x) count_leading_zeros(zeros, x);
(gdb) bt
#0  0xf900cefc in FLINT_BIT_COUNT (x=<optimized out>) at ./flint.h:355
#1  _fmpq_cmp_si (p=0xf7b023d8, q=0xf7b023dc, c=-2147483648) at cmp_si.c:44
#2  0xf900d02c in fmpq_cmp_si (x=<optimized out>, c=<optimized out>)
    at cmp_si.c:67
#3  0x000108cc in main () at test/t-cmp_si.c:45

This code in  cmp_si.c is wrong:

    d = -c;

    if (c != d) /* check for SLONG_MIN */
    {
        d = c < 0 ? -c : c;

Signed overflow is undefined behavior, so the check for SLONG_MIN got
optimized away.

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106960

Regards,
Dave Anglin

-- System Information:
Debian Release: bookworm/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
merged-usr: no
Architecture: hppa (parisc64)

Kernel: Linux 5.19.9+ (SMP w/4 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to