https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103387
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=/home/maxiwell/usr/ --build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu --enable-languages=c++ --disable-bootstrap CC=gcc-11 CXX=g++-11 ~/devel/gcc/build> make && make install ~/devel/gcc/build> /home/maxiwell/usr/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/maxiwell/usr/bin/g++ COLLECT_LTO_WRAPPER=/home/maxiwell/usr/libexec/gcc/powerpc64le-linux-gnu/12.0.0/lto-wrapper Target: powerpc64le-linux-gnu Configured with: ../configure --prefix=/home/maxiwell/usr/ --build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu --enable-languages=c++ --disable-bootstrap CC=gcc-11 CXX=g++-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 <iostream> int main() { long double n = 0.1L; std::cout << n; return 0; } ~> /home/maxiwell/usr/bin/g++ test.cpp -g -o test -mabi=ieeelongdouble ~> ./test Segmentation fault (core dumped) - It works with printf: ~> cat test-printf.cpp #include <stdio.h> int main() { long double n = 0.1L; printf("%Lg\n", n); return 0; } ~> /home/maxiwell/usr/bin/g++ test-printf.cpp -g -o test-printf -mabi=ieeelongdouble ~> ./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<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put (__v=6.95334903218850043777638611569573e-310, __fill=32 ' ', __io=..., __s=..., this=0x7ffff7f55208 <(anonymous namespace)::num_put_c>) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/powerpc64le-suse-linux/libstdc++-v3/include/bits/locale_facets.h:2461 #2 std::ostream::_M_insert<__ieee128> (this=0x7ffff7f536e8 <std::cout>, __v=6.95334903218850043777638611569573e-310) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/powerpc64le-suse-linux/libstdc++-v3/include/bits/ostream.tcc:73 #3 0x00007ffff7d368c8 in std::ostream::operator<< (this=<optimized out>, __f=<optimized out>) at /usr/src/debug/gcc11-11.1.1+git340-1.1.ppc64le/obj-powerpc64le-suse-linux/powerpc64le-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=100912 - Versions: ~> cat /etc/os-release NAME="openSUSE Tumbleweed" # VERSION="20210626" ID="opensuse-tumbleweed" ID_LIKE="opensuse suse" VERSION_ID="20210626" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20210626" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed" LOGO="distributor-logo" ~> g++-11 -v Using built-in specs. COLLECT_GCC=g++-11 COLLECT_LTO_WRAPPER=/usr/lib64/gcc/powerpc64le-suse-linux/11/lto-wrapper Target: powerpc64le-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,jit --enable-host-shared --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/11 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --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=-11 --without-system-libunwind --with-cpu=power8 --with-tune=power9 --enable-secureplt --with-long-double-128 --enable-targets=powerpcle-linux --disable-multilib --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=powerpc64le-suse-linux --host=powerpc64le-suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.1.1 20210617 [revision 79c1185de4a05fdea13b6b020795892913f8184e] (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: <http://bugs.opensuse.org>. ~> rpm -qa binutils binutils-2.36-4.14.ppc64le