]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Disable floating_to_chars.cc on 16 bit targets
authorJoern Rennecke <joern.rennecke@riscy-ip.com>
Thu, 20 May 2021 12:21:41 +0000 (13:21 +0100)
committerJoern Rennecke <joern.rennecke@riscy-ip.com>
Thu, 20 May 2021 12:41:13 +0000 (13:41 +0100)
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.

libstdc++-v3/include/std/charconv
libstdc++-v3/src/c++17/floating_to_chars.cc
libstdc++-v3/testsuite/20_util/to_chars/double.cc
libstdc++-v3/testsuite/20_util/to_chars/float.cc
libstdc++-v3/testsuite/20_util/to_chars/long_double.cc

index 6e407f31e30b0e4f5a4affb602c2f3b6ecebfd44..64a6606bb33872127d1f9f8b7c23e4005fd21335 100644 (file)
@@ -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.
index 1a0abb9e80f86127ea947581f3da2dc6dcc7bcc4..44f547a77b4c2c2cd2bc4289d580d0f812d322f1 100644 (file)
@@ -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'.
 
index bb6f74424edf7d5c72345617ee51fc55b2ce36e2..64e62213044af15c83d6fa6e6d59e5bf414c9db6 100644 (file)
@@ -33,6 +33,7 @@
 
 // { dg-do run { target c++17 } }
 // { dg-require-effective-target ieee-floats }
+// { dg-require-effective-target size32plus }
 
 #include <charconv>
 
index 0c8dd4f66dfda3262a9f77a91852150ddac885f9..73b9081d4ff96b403ceedb5baaa879e9feb12c35 100644 (file)
@@ -33,6 +33,7 @@
 
 // { dg-do run { target c++17 } }
 // { dg-require-effective-target ieee-floats }
+// { dg-require-effective-target size32plus }
 
 #include <charconv>
 
index 8cf45ad5e94184b5af5f4a1da85514a14f13951e..447e5368811a6be6a5375ed7a22c655c1233d8d1 100644 (file)
@@ -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>