]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Remove duplicate definition of _Float128 std::from_chars [PR110077]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 9 Jun 2023 10:08:03 +0000 (11:08 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 9 Jun 2023 12:15:39 +0000 (13:15 +0100)
When long double uses IEEE binary128 representation we define the
_Float128 overload of std::from_chars inline in <charconv>. My changes
in r14-1431-g7037e7b6e4ac41 cause it to also be defined non-inline in
the library, leading to an abi-check failure for (at least) sparc and
aarch64.

Suppress the definition in the library if long double and _Float128 have
are both IEEE binary128.

libstdc++-v3/ChangeLog:

PR libstdc++/110077
* src/c++17/floating_from_chars.cc (from_chars) <_Float128>:
Only define if _Float128 and long double have different
representations.

libstdc++-v3/src/c++17/floating_from_chars.cc

index f1dd1037bf3e8c0141a195b0bf442ac92447ee54..3152d64c67ccc6e2e35bbbda5b1529b0dadddde4 100644 (file)
@@ -1325,7 +1325,8 @@ _ZSt10from_charsPKcS0_RDF128_St12chars_format(const char* first,
                                              __ieee128& value,
                                              chars_format fmt) noexcept
 __attribute__((alias ("_ZSt10from_charsPKcS0_Ru9__ieee128St12chars_format")));
-#elif defined(__FLT128_MANT_DIG__)
+#elif __FLT128_MANT_DIG__ == 113 && __LDBL_MANT_DIG__ != 113
+// Overload for _Float128 is not defined inline in <charconv>, define it here.
 from_chars_result
 from_chars(const char* first, const char* last, _Float128& value,
           chars_format fmt) noexcept