From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B17DA3858C66 for ; Mon, 24 Jul 2023 20:05:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B17DA3858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690229112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OwwSm7Awb9E30f4RdXZvH7TV0r6QK3OgbXSXPrpqf3U=; b=PHQNPNtzk6lZhYWkCskrkiQZHiN6kOhKfek+rLtLWZH1m0eT9WqmMtjG5OoolTOh4zVzQA xUT5xXdcesGDKagLVPzVkozLQ8K3zFNlHCJgalq/AVzTiqQNma6qbXRWxD5/kSTqYIcC7e 2zUnzYUi9SF4BP2JhGG2yLTY/VZgnSY= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-262-OE1NBdMlNB2HGqtOsE1o9Q-1; Mon, 24 Jul 2023 16:05:09 -0400 X-MC-Unique: OE1NBdMlNB2HGqtOsE1o9Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2AD5280BC40; Mon, 24 Jul 2023 20:05:08 +0000 (UTC) Received: from localhost (unknown [10.42.28.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D69F201F11C; Mon, 24 Jul 2023 20:05:08 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++; Do not use strtold for hppa-hpux [PR110653] Date: Mon, 24 Jul 2023 21:04:23 +0100 Message-ID: <20230724200510.83085-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux, pushed to trunk. I hope this bug can be closed now, ut will have to wait for Dave Angling to post results. -- >8 -- When I switched std::stold to depend on HAVE_STRTOLD that enabled it for hppa-hpux which defines HAVE_BROKEN_STRTOLD. Add a check for that macro so that we don't use strtold, and fall through to the check for double and long double having the same representation. That should mean we define a conforming std::stold in terms of std::stod, instead of trying to use the broken strtold. Also fix a logic error in the fallback definition of std::stod, which should not treat zero as a subnormal number. libstdc++-v3/ChangeLog: PR libstdc++/110653 * include/bits/basic_string.h [!HAVE_STOF] (stof): Do not throw an exception for zero result. [HAVE_BROKEN_STRTOLD] (stold): Do not use strtold. --- libstdc++-v3/include/bits/basic_string.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index e4cb9846025..170a43664c9 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -4148,7 +4148,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 stod(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } -#if _GLIBCXX_USE_C99_STDLIB || _GLIBCXX_HAVE_STRTOF +#if _GLIBCXX_HAVE_STRTOF // NB: strtof vs strtod. inline float stof(const string& __str, size_t* __idx = 0) @@ -4158,7 +4158,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 stof(const string& __str, size_t* __idx = 0) { double __d = std::stod(__str, __idx); - if (__builtin_isfinite(__d)) + if (__builtin_isfinite(__d) && __d != 0.0) { double __abs_d = __builtin_fabs(__d); if (__abs_d < __FLT_MIN__ || __abs_d > __FLT_MAX__) @@ -4171,7 +4171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif -#if _GLIBCXX_USE_C99_STDLIB || _GLIBCXX_HAVE_STRTOLD +#if _GLIBCXX_HAVE_STRTOLD && ! _GLIBCXX_HAVE_BROKEN_STRTOLD inline long double stold(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } -- 2.41.0