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

            Bug ID: 128028
           Summary: [17 regression] gmp and mpfr miscompiled
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Sorry, I've not had opportunity to run this down yet.

```
~/bugs/gmp/gmp-6.3.0/mini-gmp $ cd tests
$ make CFLAGS="-O3 -march=x86-64-v3 -ggdb3" check
./run-tests t-add t-sub t-mul t-invert t-div t-div_2exp t-double t-cmp_d t-gcd
t-lcm t-import t-comb t-signed t-sqrt t-root t-powm t-logops t-bitops t-scan
t-str t-reuse t-aorsmul t-limbs t-cong t-pprime_p t-lucm t-mpq_addsub
t-mpq_muldiv t-mpq_muldiv_2exp t-mpq_str t-mpq_double
PASS: t-add
PASS: t-sub
PASS: t-mul
PASS: t-invert
PASS: t-div
PASS: t-div_2exp
PASS: t-double
PASS: t-cmp_d
PASS: t-gcd
PASS: t-lcm
PASS: t-import
PASS: t-comb
PASS: t-signed
PASS: t-sqrt
PASS: t-root
PASS: t-powm
PASS: t-logops
PASS: t-bitops
PASS: t-scan
PASS: t-str
PASS: t-reuse
PASS: t-aorsmul
PASS: t-limbs
PASS: t-cong
PASS: t-pprime_p
PASS: t-lucm
PASS: t-mpq_addsub
mpq_mul failed [25]:
an: 7fffffffe0000000003fffffffff80000000000040000
ad: -1c01ffff9ff8003ff000038
bn: fffffffffffc0000000ffe00000007fffffffffffffc0000000000001ffffffffff
bd: -7800001fc000000ffff000000
refn:
7fffffffdffe000000487efffffd834000000301bffdfffa00ff80000c03fe7ffbf802020009fffffffeec000000000807fffffffffc0000
refd: d20f0034c3bc013cfa0496c0386739efc0137ffc8000000
resn:
aaaaaaaa7ffd555555b5feaaaaa759aaaaaaaeacfffd554d56aa0000100553554ff55802aab7fffffffe90000000000ab5555555555
resd: 1181400465a5001a6a2b0c9004b344d3faac4aaa600
./run-tests: line 75: 80368 Aborted                    (core dumped) "$1"
$testflags
FAIL: t-mpq_muldiv
PASS: t-mpq_muldiv_2exp
PASS: t-mpq_str
PASS: t-mpq_double
====================
1 of 31 tests failed
====================
make: *** [Makefile:65: check] Error 1
```

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/17/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage.notmp/portage/sys-devel/gcc-17.0.9999/work/gcc-17.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/17
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/17/python
--enable-libphobos --enable-objc-gc
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,algol68,jit
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 17.0.9999 p, commit
0aca533a964e7df4766d71a204f3ffd681d0c256' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --enable-libada --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --with-tls=gnu2 --enable-multilib
--with-multilib-list=m32,mx32,m64 --disable-fixed-point --with-abi=m64
--enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--disable-cet --enable-systemtap --enable-valgrind-annotations
--enable-valgrind-interop --disable-vtable-verify --disable-libvtv --with-zstd
--with-isl --disable-isl-version-check --enable-default-pie --enable-host-pie
--enable-host-bind-now --enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --enable-host-shared
--enable-libgdiagnostics --with-build-config='bootstrap-O3 bootstrap-lto'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261020 (experimental)
011070daf505fd1d9d910a2656f444b64ac61e5e (Gentoo Hardened 17.0.9999 p, commit
0aca533a964e7df4766d71a204f3ffd681d0c256)
```

mini-gmp is likely the best way to get a testcase for this. I'm not sure if the
mpfr miscompilation is actually from its own use of mini-gmp or not.

I'll bisect now at least.

Reply via email to