From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D69DA3858C1F; Tue, 28 Mar 2023 16:48:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D69DA3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680022089; bh=Va4DXe83xUKPaePYc03Gp8A0p1e9SPOgGQMzNfaCBGY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TkLdg0qI3TGKf1vIwCMF9Nw3BsIUZYlWDv9TqMEg2zxmDtEUKHhKGHqRw0f5CVWsq TH7uBu+YE3UjIyoJUsSWZVleWAsaN7yIyrOpL61Rgvat9cDfeljIjhPP43zEHkdaUv W7oxpaVBtYEaZl4A/YVKrxXF5XvfPnd6Q8zB4pzo= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103387] powerpc64le: segmentation fault on std::cout with ieee128 long double variable Date: Tue, 28 Mar 2023 16:48:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103387 --- Comment #9 from Jonathan Wakely --- This fixes the testcase, but I'll check for other problems using the cached facets: --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -69,7 +69,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ios_base::iostate __err =3D ios_base::goodbit; __try { +#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT const __num_put_type& __np =3D __check_facet(this->_M_num_p= ut); +#else + const __num_put_type& __np + =3D use_facet<__num_put_type>(this->_M_ios_locale); +#endif if (__np.put(*this, *this, this->fill(), __v).failed()) __err |=3D ios_base::badbit; } The _M_num_put cache exists to avoid doing the RTTI check implied by use_fa= cet every time we use the stream. But that RTTI check has been removed for GCC = 13 anyway. Since the cached facet is the cause of this bug, we can just ignore= it for powercp64le when we support two forms of long double.=