public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-6918] libstdc++: Do not use facets cached in ios for ATL128 build [PR103387]
Date: Tue, 28 Mar 2023 23:18:49 +0000 (GMT)	[thread overview]
Message-ID: <20230328231849.40E353858D39@sourceware.org> (raw)

https://gcc.gnu.org/g:ec12639c82e944d37200a744156e183ea19add00

commit r13-6918-gec12639c82e944d37200a744156e183ea19add00
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Mar 28 21:07:21 2023 +0100

    libstdc++: Do not use facets cached in ios for ATL128 build [PR103387]
    
    For the powerpc64le build with two different long double
    representations, we cannot use the ios_base::_M_num_put and
    ios_base::_M_num_get pointers, because they might have been initialized
    in a translation unit using the other long double type. With the changes
    to add __try_use_facet to GCC 13 the cache isn't really needed now, we
    can just access the right facet in the locale directly, without needing
    RTTI checks.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/103387
            * include/bits/istream.tcc (istream::_M_extract(ValueT&)): Use
            std::use_facet instead of cached _M_num_get facet.
            (istream::operator>>(short&)): Likewise.
            (istream::operator>>(int&)): Likewise.
            * include/bits/ostream.tcc (ostream::_M_insert(ValueT)): Use
            std::use_facet instead of cached _M_num_put facet.

Diff:
---
 libstdc++-v3/include/bits/istream.tcc | 15 +++++++++++++++
 libstdc++-v3/include/bits/ostream.tcc |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 733a8359902..334a91755aa 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -102,7 +102,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    ios_base::iostate __err = ios_base::goodbit;
 	    __try
 	      {
+#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
 		const __num_get_type& __ng = __check_facet(this->_M_num_get);
+#else
+		const __num_get_type& __ng
+		  = use_facet<__num_get_type>(this->_M_ios_locale);
+#endif
 		__ng.get(*this, 0, *this, __err, __v);
 	      }
 	    __catch(__cxxabiv1::__forced_unwind&)
@@ -132,7 +137,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  __try
 	    {
 	      long __l;
+#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
 	      const __num_get_type& __ng = __check_facet(this->_M_num_get);
+#else
+	      const __num_get_type& __ng
+		= use_facet<__num_get_type>(this->_M_ios_locale);
+#endif
 	      __ng.get(*this, 0, *this, __err, __l);
 
 	      // _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -177,7 +187,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  __try
 	    {
 	      long __l;
+#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
 	      const __num_get_type& __ng = __check_facet(this->_M_num_get);
+#else
+	      const __num_get_type& __ng
+		= use_facet<__num_get_type>(this->_M_ios_locale);
+#endif
 	      __ng.get(*this, 0, *this, __err, __l);
 
 	      // _GLIBCXX_RESOLVE_LIB_DEFECTS
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index e20012d2dc6..bb8584276f5 100644
--- 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;
 	      }

                 reply	other threads:[~2023-03-28 23:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230328231849.40E353858D39@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).