From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 181D93858D28; Tue, 23 Nov 2021 17:23:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 181D93858D28 From: "maxiwell at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103387] New: powerpc64le: segmentation fault on std::cout with ieee128 long double variable Date: Tue, 23 Nov 2021 17:22:59 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: maxiwell at gmail dot 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: Tue, 23 Nov 2021 17:23:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103387 Bug ID: 103387 Summary: powerpc64le: segmentation fault on std::cout with ieee128 long double variable Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: maxiwell at gmail dot com Target Milestone: --- How to reproduce: - Building GCC from the master branch: ~/devel> git clone git://gcc.gnu.org/git/gcc.git && cd gcc/ ~/devel/gcc> git rev-parse HEAD a944b5dec3adb28ed199234d2116145ca9010d6a ~/devel/gcc> mkdir build && cd build ~/devel/gcc/build> ../configure --prefix=3D/home/maxiwell/usr/ --build=3Dpowerpc64le-linux-gnu --host=3Dpowerpc64le-linux-gnu --target=3Dpowerpc64le-linux-gnu --enable-languages=3Dc++ --disable-bootstr= ap CC=3Dgcc-11 CXX=3Dg++-11 ~/devel/gcc/build> make && make install ~/devel/gcc/build> /home/maxiwell/usr/bin/g++ -v Using built-in specs. COLLECT_GCC=3D/home/maxiwell/usr/bin/g++ COLLECT_LTO_WRAPPER=3D/home/maxiwell/usr/libexec/gcc/powerpc64le-linux-gnu/= 12.0.0/lto-wrapper Target: powerpc64le-linux-gnu Configured with: ../configure --prefix=3D/home/maxiwell/usr/ --build=3Dpowerpc64le-linux-gnu --host=3Dpowerpc64le-linux-gnu --target=3Dpowerpc64le-linux-gnu --enable-languages=3Dc++ --disable-bootstr= ap CC=3Dgcc-11 CXX=3Dg++-11 Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20211123 (experimental) (GCC) - Running a simple C++ program to print an IEEE long double var using std::= cout ~> cat test.cpp #include int main() { long double n =3D 0.1L; std::cout << n; return 0; } ~> /home/maxiwell/usr/bin/g++ test.cpp -g -o test -mabi=3Dieeelongdouble ~> ./test Segmentation fault (core dumped) - It works with printf: ~> cat test-printf.cpp #include int main() { long double n =3D 0.1L; printf("%Lg\n", n); return 0; } ~> /home/maxiwell/usr/bin/g++ test-printf.cpp -g -o test-printf -mabi=3Dieeelongdouble ~> ./test-printf 0.1 - Running the std::cout program with GDB ~> gdb -q -s --args test Reading symbols from test... (gdb) r Starting program: /home/maxiwell/test Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007ffff7d3667c in std::__gnu_cxx_ieee128::num_put > >::put (__v=3D6.95334903218850043777638611569573e-310, __fill=3D32 ' ', __io=3D..., __s=3D..., this=3D0x7ffff7f55208 <(anonymous namespace)::nu= m_put_c>) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/p= owerpc64le-suse-linux/libstdc++-v3/include/bits/locale_facets.h:2461 #2 std::ostream::_M_insert<__ieee128> (this=3D0x7ffff7f536e8 , __v=3D6.95334903218850043777638611569573e-310) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/p= owerpc64le-suse-linux/libstdc++-v3/include/bits/ostream.tcc:73 #3 0x00007ffff7d368c8 in std::ostream::operator<< (this=3D, __f=3D) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/p= owerpc64le-suse-linux/libstdc++-v3/include/ostream:233 #4 0x000000001000098c in main () at test.cpp:6 The __v parameter from #1 and #2 has the same value that was reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100912 - Versions: ~> cat /etc/os-release NAME=3D"openSUSE Tumbleweed" # VERSION=3D"20210626" ID=3D"opensuse-tumbleweed" ID_LIKE=3D"opensuse suse" VERSION_ID=3D"20210626" PRETTY_NAME=3D"openSUSE Tumbleweed" ANSI_COLOR=3D"0;32" CPE_NAME=3D"cpe:/o:opensuse:tumbleweed:20210626" 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" ~> 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.1.1 20210617 [revision 79c1185de4a05fdea13b6b020795892913f81= 84e] (SUSE Linux) ~> /lib64/libc.so.6 GNU C Library (GNU libc) release release version 2.33 (git 9826b03b74). Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Configured for ppc64le-suse-linux. Compiled by GNU CC version 11.1.1 20210510 [revision 23855a176609fe8dda6abaf2b21846b4517966eb]. libc ABIs: UNIQUE IFUNC ABSOLUTE For bug reporting instructions, please see: . ~> rpm -qa binutils binutils-2.36-4.14.ppc64le=