From: Joern Wolfgang Rennecke <joern.rennecke@riscy-ip.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>, libstdc++@gcc.gnu.org
Subject: committed: Fix PR libstdc++/100361
Date: Thu, 20 May 2021 13:48:22 +0100 [thread overview]
Message-ID: <9e1cacac-90fa-fcfc-15b9-0d215b952ed2@riscy-ip.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 253 bytes --]
commit 66c5f24788652a49b528f14e23e8121ad0935ace (trunk)
commit 5f772bd9847cdbf6a7a6d856de87cb65472d56f4 (releases/gcc11)
As approved by Jonathan Wakely in the comments to PR libstdc++/100361 .
Bootstrapped and regression tested on x86_64-pc-linux.gnu.
[-- Attachment #2: pr100361-fix-2.txt --]
[-- Type: text/plain, Size: 3408 bytes --]
2021-05-18 Joern Rennecke <joern.rennecke@riscy-ip.com>
libstdc++: Disable floating_to_chars.cc on 16 bit targets
This patch conditionally disables the compilation of floating_to_chars.cc
on 16 bit targets, thus fixing a build failure for these targets as
the POW10_SPLIT_2 array exceeds the maximum object size.
libstdc++-v3/
PR libstdc++/100361
* include/std/charconv (to_chars): Hide the overloads for
floating-point types for 16 bit targets.
* src/c++17/floating_to_chars.cc: Don't compile for 16 bit targets.
* testsuite/20_util/to_chars/double.cc: Run this test only on
size32plus targets.
* testsuite/20_util/to_chars/float.cc: Likewise.
* testsuite/20_util/to_chars/long_double.cc: Likewise.
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index 193702e677a..ac9c34d4601 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -703,7 +703,8 @@ namespace __detail
chars_format __fmt = chars_format::general) noexcept;
#endif
-#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64
+#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
+ && __SIZE_WIDTH__ >= 32
// Floating-point std::to_chars
// Overloads for float.
diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc
index 1a0abb9e80f..44f547a77b4 100644
--- a/libstdc++-v3/src/c++17/floating_to_chars.cc
+++ b/libstdc++-v3/src/c++17/floating_to_chars.cc
@@ -50,7 +50,9 @@ extern "C" int __sprintfieee128(char*, const char*, ...);
// This implementation crucially assumes float/double have the
// IEEE binary32/binary64 formats.
-#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64
+#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
+ /* And it also assumes that uint64_t POW10_SPLIT_2[3133][3] is valid. */\
+ && __SIZE_WIDTH__ >= 32
// Determine the binary format of 'long double'.
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/double.cc b/libstdc++-v3/testsuite/20_util/to_chars/double.cc
index bb6f74424ed..64e62213044 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/double.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/double.cc
@@ -33,6 +33,7 @@
// { dg-do run { target c++17 } }
// { dg-require-effective-target ieee-floats }
+// { dg-require-effective-target size32plus }
#include <charconv>
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/float.cc b/libstdc++-v3/testsuite/20_util/to_chars/float.cc
index 0c8dd4f66df..73b9081d4ff 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/float.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/float.cc
@@ -33,6 +33,7 @@
// { dg-do run { target c++17 } }
// { dg-require-effective-target ieee-floats }
+// { dg-require-effective-target size32plus }
#include <charconv>
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc b/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc
index 8cf45ad5e94..447e5368811 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc
@@ -35,6 +35,7 @@
// { dg-xfail-run-if "Non-conforming printf (see PR98384)" { *-*-solaris* *-*-darwin* } }
// { dg-require-effective-target ieee-floats }
+// { dg-require-effective-target size32plus }
#include <charconv>
reply other threads:[~2021-05-20 12:48 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=9e1cacac-90fa-fcfc-15b9-0d215b952ed2@riscy-ip.com \
--to=joern.rennecke@riscy-ip.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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).