From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9C010386100A; Tue, 23 Mar 2021 18:08:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C010386100A From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97653] Incorrect long double calculation with -mabi=ibmlongdouble Date: Tue, 23 Mar 2021 18:08:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: meissner at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2021 18:08:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97653 --- Comment #9 from Jonathan Wakely --- [test@ibm-p8-cluster-02 ~]$ cat 97653.c int printf(const char*, ...); const unsigned long k =3D 256; int main() { long double r[] =3D { 0.1L, 0.2L, 0.5L, 0.9L }; for (int i =3D 0; i < 4; ++i) { unsigned long j =3D k * r[i]; printf("%lu * %Lf =3D %lu\n", k, r[i], j); } } [test@ibm-p8-cluster-02 ~]$ ~/gcc/ieee/bin/gcc 97653.c -mno-gnu-attribute -mabi=3Dibmlongdouble -Wall -static-libgcc -v && ./a.out Using built-in specs. COLLECT_GCC=3D/home/test/gcc/ieee/bin/gcc COLLECT_LTO_WRAPPER=3D/home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-l= inux-gnu/11.0.1/lto-wrapper Target: powerpc64le-unknown-linux-gnu Configured with: /home/test/src/gcc/configure --prefix=3D/home/test/gcc/ieee --disable-multilib --disable-bootstrap --enable-languages=3Dc++ --disable-p= ch --disable-nls --without-isl --with-long-double-format=3Dieee : (reconfigure= d) /home/test/src/gcc/configure --prefix=3D/home/test/gcc/ieee --disable-multi= lib --disable-bootstrap --enable-languages=3Dc++ --disable-pch --disable-nls --without-isl --with-long-double-format=3Dieee Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.1 20210323 (experimental) (GCC)=20 COLLECT_GCC_OPTIONS=3D'-mno-gnu-attribute' '-mabi=3Dibmlongdouble' '-Wall' '-static-libgcc' '-v' '-dumpdir' 'a-' /home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu/11.0.1/cc1 -quiet -v 97653.c -quiet -dumpdir a- -dumpbase 97653.c -dumpbase-ext .c -mno-gnu-attribute -mabi=3Dibmlongdouble -Wall -version -o /tmp/ccNHNZzj.s GNU C17 (GCC) version 11.0.1 20210323 (experimental) (powerpc64le-unknown-linux-gnu) compiled by GNU C version 11.0.0 20210225 (Red Hat 11.0.0-0), GMP version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none GGC heuristics: --param ggc-min-expand=3D30 --param ggc-min-heapsize=3D4096 ignoring nonexistent directory "/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/../../../= ../powerpc64le-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/include /usr/local/include /home/test/gcc/ieee/include /home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/include-f= ixed /usr/include End of search list. GNU C17 (GCC) version 11.0.1 20210323 (experimental) (powerpc64le-unknown-linux-gnu) compiled by GNU C version 11.0.0 20210225 (Red Hat 11.0.0-0), GMP version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none GGC heuristics: --param ggc-min-expand=3D30 --param ggc-min-heapsize=3D4096 Compiler executable checksum: ab29af0a0f73449cd280c2751cbad267 COLLECT_GCC_OPTIONS=3D'-mno-gnu-attribute' '-mabi=3Dibmlongdouble' '-Wall' '-static-libgcc' '-v' '-dumpdir' 'a-' as -v -a64 -mpower8 -mlittle -o /tmp/cc4MmQYf.o /tmp/ccNHNZzj.s GNU assembler version 2.35.1 (ppc64le-redhat-linux) using BFD version versi= on 2.35.1-41.fc34 COMPILER_PATH=3D/home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-g= nu/11.0.1/:/home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu/11= .0.1/:/home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu/:/home/= test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/:/home/test/gcc/= ieee/lib/gcc/powerpc64le-unknown-linux-gnu/ LIBRARY_PATH=3D/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11= .0.1/:/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/../.= ./../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/home/test/gcc/ieee/lib/gc= c/powerpc64le-unknown-linux-gnu/11.0.1/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS=3D'-mno-gnu-attribute' '-mabi=3Dibmlongdouble' '-Wall' '-static-libgcc' '-v' '-dumpdir' 'a.' /home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu/11.0.1/colle= ct2 -plugin /home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu/11.0.1/liblto= _plugin.so -plugin-opt=3D/home/test/gcc/ieee/libexec/gcc/powerpc64le-unknown-linux-gnu= /11.0.1/lto-wrapper -plugin-opt=3D-fresolution=3D/tmp/ccwamb6Q.res -plugin-opt=3D-pass-through= =3D-lgcc -plugin-opt=3D-pass-through=3D-lgcc_eh -plugin-opt=3D-pass-through=3D-lc -plugin-opt=3D-pass-through=3D-lgcc -plugin-opt=3D-pass-through=3D-lgcc_eh --eh-frame-hdr -V -m elf64lppc -dynamic-linker /lib64/ld64.so.2 /lib/../lib64/crt1.o /lib/../lib64/crti.o /home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/crtbegin.o -L/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1 -L/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/../../..= /../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/../../.. /tmp/cc4MmQYf.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /home/test/gcc/ieee/lib/gcc/powerpc64le-unknown-linux-gnu/11.0.1/crtend.o /lib/../lib64/crtn.o GNU ld version 2.35.1-41.fc34 Supported emulations: elf64lppc elf32lppc elf32lppclinux elf32lppcsim elf64ppc elf32ppc elf32ppclinux elf32ppcsim elf32_spu i386pep i386pe elf64bpf COLLECT_GCC_OPTIONS=3D'-mno-gnu-attribute' '-mabi=3Dibmlongdouble' '-Wall' '-static-libgcc' '-v' '-dumpdir' 'a.' 256 * 0.100000 =3D 256 256 * 0.200000 =3D 256 256 * 0.500000 =3D 256 256 * 0.900000 =3D 256=