From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 3FCDC3857711; Wed, 19 Jul 2023 22:43:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FCDC3857711 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689806590; bh=sPqz1d5z7exNoQqcZXjn86ae8hw7rzwLCzxblmvh3sM=; h=From:To:Subject:Date:From; b=dadLsoWjith2avm0xHW9tyh5NBfmRmCj+ebL7GFlAPuDTVWC8c10LQlXWTKdf4txi AZMvFhSXJYCOp/fjLOjrNVH1bTttkyWXDGAQbKXFn4f3U8nlrBTxkrJ8vI6YemjIaF 0mG2ciUzrQ5BHR19uCElEx2WeKtz4TLJHXHCy0yA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-2661] libstdc++: Do not define inaccurate from_chars for _Float128 [PR110077] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 2d614822e9ea2a3d8800045d66e3220743753d09 X-Git-Newrev: 0867d30a68de68f4c809757348447bef94ef1491 Message-Id: <20230719224310.3FCDC3857711@sourceware.org> Date: Wed, 19 Jul 2023 22:43:10 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0867d30a68de68f4c809757348447bef94ef1491 commit r14-2661-g0867d30a68de68f4c809757348447bef94ef1491 Author: Jonathan Wakely Date: Wed Jul 19 21:15:17 2023 +0100 libstdc++: Do not define inaccurate from_chars for _Float128 [PR110077] I think r14-1431-g7037e7b6e4ac41 was wrong to try to define the _Float128 overload unconditionally. Not all targets need it, so defining the lossy fallback using long double is not useful (and caused an ABI change on Solaris x86). Making the definition depend on USE_STRTOF128_FOR_FROM_CHARS again partially reverts the change for PR 109921, however that should still be fixed because the changes to make USE_STRTOF128_FOR_FROM_CHARS depend on USE_STRTOD_FOR_FROM_CHARS are not reverted. libstdc++-v3/ChangeLog: PR libstdc++/110077 * src/c++17/floating_from_chars.cc (from_chars): Only define _Float128 overload when using __strfromf128. Diff: --- libstdc++-v3/src/c++17/floating_from_chars.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc index 3152d64c67c..e421c5adc3e 100644 --- a/libstdc++-v3/src/c++17/floating_from_chars.cc +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc @@ -1325,24 +1325,14 @@ _ZSt10from_charsPKcS0_RDF128_St12chars_format(const char* first, __ieee128& value, chars_format fmt) noexcept __attribute__((alias ("_ZSt10from_charsPKcS0_Ru9__ieee128St12chars_format"))); -#elif __FLT128_MANT_DIG__ == 113 && __LDBL_MANT_DIG__ != 113 +#elif defined(USE_STRTOF128_FOR_FROM_CHARS) // Overload for _Float128 is not defined inline in , define it here. from_chars_result from_chars(const char* first, const char* last, _Float128& value, chars_format fmt) noexcept { -#ifdef USE_STRTOF128_FOR_FROM_CHARS // fast_float doesn't support IEEE binary128 format, but we can use strtold. return from_chars_strtod(first, last, value, fmt); -#else - // Read a long double. This might give an incorrect result (e.g. values - // out of range of long double give an error, even if they fit in _Float128). - long double ldbl_val; - auto res = std::from_chars(first, last, ldbl_val, fmt); - if (res.ec == errc{}) - value = ldbl_val; - return res; -#endif } #endif