https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103387

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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 = ios_base::goodbit;
            __try
              {
+#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
                const __num_put_type& __np = __check_facet(this->_M_num_put);
+#else
+               const __num_put_type& __np
+                 = use_facet<__num_put_type>(this->_M_ios_locale);
+#endif
                if (__np.put(*this, *this, this->fill(), __v).failed())
                  __err |= ios_base::badbit;
              }

The _M_num_put cache exists to avoid doing the RTTI check implied by use_facet
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.

Reply via email to