https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84377
Bug ID: 84377 Summary: gcc-7.3.0 miscompiles truncf128@@GLIBC_2.26 in libm.so Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dilfridge at gentoo dot org Target Milestone: --- Created attachment 43411 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43411&action=edit preprocessed source I stumbled on this when trying to track down failures in the glibc-2.26 testsuite on Gentoo. See also for the initial report https://sourceware.org/bugzilla/show_bug.cgi?id=22826 * Problem occurs only with gcc-7.3.0, not gcc-6.4.0 with identical settings * Problem occurs only when the test program loads libm.so compiled by said compiler; which compiler is used to compile the test binary doesn't matter. * Problem occurs (at least) when building a -m32 library in an x86-64 system; a pure 32 bit install seems to be fine (but it has different CFLAGS etc). * The test reports that truncf returns completely wrong data. Example: testing _Float128 (without inline functions) Failure: Test: trunc (1.625) Result: is: 1.62500000000000000000000000000000000e+00 0x1.a000000000000000000000000000p+0 should be: 1.00000000000000000000000000000000000e+00 0x1.0000000000000000000000000000p+0 difference: 6.25000000000000000000000000000000000e-01 0x1.4000000000000000000000000000p-1 ulp : 3245185536584267267831560205762560.0000 max.ulp : 0.0000 Compiler call: x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed --save-temps ../sysdeps/ieee754/float128/s_truncf128.c -c -std=gnu11 -fgnu89-inline -O2 -Wall -Wundef -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -frounding-math -fstack-protector-all -ggdb -march=native -Wstrict-prototypes -Wold-style-definition -mpreferred-stack-boundary=4 -fPIC -Wa,-mtune=i686 -U_FORTIFY_SOURCE -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -I../include -I/var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl/math -I/var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl -I../sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/i386/i686/nptl -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/x86 -I../sysdeps/x86/nptl -I../sysdeps/i386/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu/multiarch -I../sysdeps/i386/i686/fpu -I../sysdeps/i386/i686/multiarch -I../sysdeps/i386/i686 -I../sysdeps/i386/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu -I../sysdeps/i386 -I../sysdeps/x86 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl/libc-modules.h -DMODULE_NAME=libm -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -I../soft-fp -o /var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl/math/s_truncf128.os -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl/math/s_truncf128.os.dt -MT /var/tmp/portage/sys-libs/glibc-2.26-r6/work/build-x86-x86_64-pc-linux-gnu-nptl/math/s_truncf128.os Preprocessed source will be attached. Compiler version: gcc (Gentoo 7.3.0 p1.0) 7.3.0 (please get back to me for questions about the Gentoo patchset) A disassembly of the binaries is attached to the glibc bug. More info on request.