From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DA43399E057; Fri, 4 Jun 2021 18:51:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DA43399E057 From: "msc at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100912] New: powerpc64le: ieee128 long double incorrectly printed when using shared libstdc++ Date: Fri, 04 Jun 2021 18:51:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msc at linux dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 04 Jun 2021 18:51:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100912 Bug ID: 100912 Summary: powerpc64le: ieee128 long double incorrectly printed when using shared libstdc++ Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: msc at linux dot ibm.com Target Milestone: --- Steps to reproduce: - Build gcc with IEEE128 as the default long double format (using GCC source revision cb6e6d5faa3f817435b6f203226fa5969d7a7264). ~/build/gcc> ~/src/gcc/configure --prefix=3D/home/mscastanho/usr --with-long-double-128 --with-long-double-format=3Dieee --build=3Dpowerpc64le-linux-gnu --host=3Dpowerpc64le-linux-gnu --target=3Dpowerpc64le-linux-gnu --enable-languages=3Dc++ --with-glibc-vers= ion=3D2.33 --disable-bootstrap CC=3Dgcc-11 CXX=3Dg++-11 ~/build/gcc> make && make install ~/build/gcc> /home/mscastanho/usr/bin/g++ -v Using built-in specs. COLLECT_GCC=3D/home/mscastanho/usr/bin/g++ COLLECT_LTO_WRAPPER=3D/home/mscastanho/usr/libexec/gcc/powerpc64le-linux-gn= u/12.0.0/lto-wrapper Target: powerpc64le-linux-gnu Configured with: /home/mscastanho/src/gcc/configure --prefix=3D/home/mscastanho/usr --with-long-double-128 --with-long-double-format=3Dieee --build=3Dpowerpc64le-linux-gnu --host=3Dpowerpc64le-linux-gnu --target=3Dpowerpc64le-linux-gnu --enable-languages=3Dc++ --with-glibc-version=3D2.33 --disable-bootstrap CC= =3Dgcc-11 CXX=3Dg++-11 Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210604 (experimental) (GCC) - Build and run simple test program with the new compiler and libstdc++ ~/build/gcc> cat ~/test-ieee128.cpp=20 #include using namespace std; int main () { long double n =3D 1.0L; cout << n << endl; return 0; } ~/build/gcc> /home/mscastanho/usr/bin/g++ -g ~/test-ieee128.cpp -o test-sha= red ~/build/gcc> LD_PRELOAD=3D~/usr/lib64/libstdc++.so.6 ./test-shared 6.95326e-310 Here I'd expect "1" to be printed.=20 If the same program is statically linked to libstdc++, it works as expected: mscastanho@yanny4:~/build/gcc> /home/mscastanho/usr/bin/g++ -g -static-libstdc++ ~/test-ieee128.cpp -o test-static mscastanho@yanny4:~/build/gcc> ./test-static=20 1 After running the two programs side-by-side under gdb, I found out they are actually calling two different symbols for vsnprintf on std::__convert_from= _v. Dynamically linked binary: >>> disas _ZSt16__convert_from_vRKP15__locale_structPciPKcz Dump of assembler code for function _ZSt16__convert_from_vRKP15__locale_structPciPKcz: 0x00007ffff7d19340 <+0>: addis r2,r12,37 0x00007ffff7d19344 <+4>: addi r2,r2,-14912 =3D> 0x00007ffff7d19348 <+8>: mflr r0 0x00007ffff7d1934c <+12>: std r29,-24(r1) 0x00007ffff7d19350 <+16>: std r30,-16(r1) 0x00007ffff7d19354 <+20>: mr r29,r6 0x00007ffff7d19358 <+24>: std r31,-8(r1) 0x00007ffff7d1935c <+28>: mr r30,r5 0x00007ffff7d19360 <+32>: mr r31,r4 0x00007ffff7d19364 <+36>: std r0,16(r1) 0x00007ffff7d19368 <+40>: stdu r1,-64(r1) 0x00007ffff7d1936c <+44>: std r7,128(r1) 0x00007ffff7d19370 <+48>: std r8,136(r1) 0x00007ffff7d19374 <+52>: std r10,152(r1) 0x00007ffff7d19378 <+56>: std r9,144(r1) 0x00007ffff7d1937c <+60>: ld r3,0(r3) 0x00007ffff7d19380 <+64>: bl 0x7ffff7d09b60 <000006bf.plt_call.__uselocale@@GLIBC_2.17> 0x00007ffff7d19384 <+68>: ld r2,24(r1) 0x00007ffff7d19388 <+72>: mr r5,r29 0x00007ffff7d1938c <+76>: mr r4,r30 0x00007ffff7d19390 <+80>: addi r6,r1,128 0x00007ffff7d19394 <+84>: mr r9,r3 0x00007ffff7d19398 <+88>: mr r3,r31 0x00007ffff7d1939c <+92>: mr r30,r9 0x00007ffff7d193a0 <+96>: bl 0x7ffff7d112a0 <000006bf.plt_call.vsnprintf@@GLIBC_2.17> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 0x00007ffff7d193a4 <+100>: ld r2,24(r1) 0x00007ffff7d193a8 <+104>: mr r31,r3 0x00007ffff7d193ac <+108>: mr r3,r30 0x00007ffff7d193b0 <+112>: bl 0x7ffff7d09b60 <000006bf.plt_call.__uselocale@@GLIBC_2.17> 0x00007ffff7d193b4 <+116>: ld r2,24(r1) 0x00007ffff7d193b8 <+120>: addi r1,r1,64 0x00007ffff7d193bc <+124>: mr r3,r31 0x00007ffff7d193c0 <+128>: ld r0,16(r1) 0x00007ffff7d193c4 <+132>: ld r29,-24(r1) 0x00007ffff7d193c8 <+136>: ld r30,-16(r1) 0x00007ffff7d193cc <+140>: ld r31,-8(r1) 0x00007ffff7d193d0 <+144>: mtlr r0 0x00007ffff7d193d4 <+148>: blr 0x00007ffff7d193d8 <+152>: .long 0x0 0x00007ffff7d193dc <+156>: .long 0x1000900 0x00007ffff7d193e0 <+160>: .long 0x380 End of assembler dump. Statically linked binary: >>> disas _ZSt16__convert_from_vRKP15__locale_structPciPKcz Dump of assembler code for function _ZSt16__convert_from_vRKP15__locale_structPciPKcz: 0x000000001002e470 <+0>: lis r2,4122 0x000000001002e474 <+4>: addi r2,r2,31744 =3D> 0x000000001002e478 <+8>: mflr r0 0x000000001002e47c <+12>: std r29,-24(r1) 0x000000001002e480 <+16>: std r30,-16(r1) 0x000000001002e484 <+20>: mr r29,r6 0x000000001002e488 <+24>: std r31,-8(r1) 0x000000001002e48c <+28>: mr r30,r5 0x000000001002e490 <+32>: mr r31,r4 0x000000001002e494 <+36>: std r0,16(r1) 0x000000001002e498 <+40>: stdu r1,-64(r1) 0x000000001002e49c <+44>: std r7,128(r1) 0x000000001002e4a0 <+48>: std r8,136(r1) 0x000000001002e4a4 <+52>: std r10,152(r1) 0x000000001002e4a8 <+56>: std r9,144(r1) 0x000000001002e4ac <+60>: ld r3,0(r3) 0x000000001002e4b0 <+64>: bl 0x10003720 <0000011a.plt_call.__uselocale@@GLIBC_2.17> 0x000000001002e4b4 <+68>: ld r2,24(r1) 0x000000001002e4b8 <+72>: mr r5,r29 0x000000001002e4bc <+76>: mr r4,r30 0x000000001002e4c0 <+80>: addi r6,r1,128 0x000000001002e4c4 <+84>: mr r9,r3 0x000000001002e4c8 <+88>: mr r3,r31 0x000000001002e4cc <+92>: mr r30,r9 0x000000001002e4d0 <+96>: bl 0x10003280 <0000011a.plt_call.__vsnprintfieee128@@GLIBC_2.32> <<<<<<<<<<<<<<<<<<<<< 0x000000001002e4d4 <+100>: ld r2,24(r1) 0x000000001002e4d8 <+104>: mr r31,r3 0x000000001002e4dc <+108>: mr r3,r30 0x000000001002e4e0 <+112>: bl 0x10003720 <0000011a.plt_call.__uselocale@@GLIBC_2.17> 0x000000001002e4e4 <+116>: ld r2,24(r1) 0x000000001002e4e8 <+120>: addi r1,r1,64 0x000000001002e4ec <+124>: mr r3,r31 0x000000001002e4f0 <+128>: ld r0,16(r1) 0x000000001002e4f4 <+132>: ld r29,-24(r1) 0x000000001002e4f8 <+136>: ld r30,-16(r1) 0x000000001002e4fc <+140>: ld r31,-8(r1) 0x000000001002e500 <+144>: mtlr r0 0x000000001002e504 <+148>: blr 0x000000001002e508 <+152>: .long 0x0 0x000000001002e50c <+156>: .long 0x1000900 0x000000001002e510 <+160>: .long 0x380 End of assembler dump. Software versions used: Distro: ~/build/gcc> cat /etc/os-release=20 NAME=3D"openSUSE Tumbleweed" # VERSION=3D"20210105" ID=3D"opensuse-tumbleweed" ID_LIKE=3D"opensuse suse" VERSION_ID=3D"20210105" PRETTY_NAME=3D"openSUSE Tumbleweed" ANSI_COLOR=3D"0;32" CPE_NAME=3D"cpe:/o:opensuse:tumbleweed:20210105" BUG_REPORT_URL=3D"https://bugs.opensuse.org" HOME_URL=3D"https://www.opensuse.org/" DOCUMENTATION_URL=3D"https://en.opensuse.org/Portal:Tumbleweed" LOGO=3D"distributor-logo" GCC used to build the new compiler: ~/build/gcc> g++-11 -v Using built-in specs. COLLECT_GCC=3Dg++-11 COLLECT_LTO_WRAPPER=3D/usr/lib64/gcc/powerpc64le-suse-linux/11/lto-wrapper Target: powerpc64le-suse-linux Configured with: ../configure --prefix=3D/usr --infodir=3D/usr/share/info --mandir=3D/usr/share/man --libdir=3D/usr/lib64 --libexecdir=3D/usr/lib64 --enable-languages=3Dc,c++,objc,fortran,obj-c++,ada,go,jit --enable-host-sh= ared --enable-checking=3Drelease --disable-werror --with-gxx-include-dir=3D/usr/include/c++/11 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=3Dauto --disable-libcc1 --enable-plugin --with-bugurl=3Dhttps://bugs.opensuse.org/ --with-pkgversion=3D'SUSE Linux' --with-slibdir=3D/lib64 --with-system-zlib --enable-libstdcxx-allocator=3Dn= ew --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=3D-11 --without-system-libu= nwind --with-cpu=3Dpower8 --with-tune=3Dpower9 --enable-secureplt --with-long-dou= ble-128 --enable-targets=3Dpowerpcle-linux --disable-multilib --with-build-config=3Dbootstrap-lto-lean --enable-link-mutex --build=3Dpowerpc64le-suse-linux --host=3Dpowerpc64le-suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.0.0 20210118 (experimental) [revision 76c1dd15e4a056a59a13b2208af23a6bd67c2682] (SUSE Linux) glibc: ~/build/gcc> /lib64/libc.so.6=20 GNU C Library (GNU libc) release release version 2.33 (git 9826b03b74). [...] binutils: ~/build/gcc> rpm -qa binutils binutils-2.35.1-1.1.ppc64le=