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.129.124]) by sourceware.org (Postfix) with ESMTPS id A333F3870868 for ; Tue, 9 Apr 2024 23:22:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A333F3870868 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A333F3870868 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712704959; cv=none; b=HrZSrkCnvLGa3+iG5QHmVi25MVDB9OzuXIPrGU1y3WwXQ+KUa3/c15hK3QVfX07lRUC1W/00PLMkkv8bnlii9ZXNYqhr2sgS1UqHrtvmxM58/5GEZxG/C8vHYNffO4dLLQXiSRlDGFyTNu2UtbdRdW4MQIdcDC7TBnE/NY1BmJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712704959; c=relaxed/simple; bh=H7GpdKAmvGX8oC0Qv4bYNQTBfdzMjpdBHW9bTFFrKnA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mn6oFkf3BnsWoJXKlZHyqOMShXHKzWD18c0o/+k/7OsYgA7um5dJcOEATca15v1dY0UpMwPDykORRV9rXMC3HlyLyx+6DDttFHKCrJzwOOleOE15tErvpBlnJr4c0Ty8ZJk43Ufc1CqSXBUfNQik8JqQ/jvBHgwRuhBneOLOn7s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712704957; 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=oqT8hb7GJq+L1zKqnTLqd3PgThMG7tiWizjdjWENDkg=; b=Gdskt0lbNSu1VIxoNWNVSSDhiCV+lGtJRWQen+OLy6pIcbU25v5xAdWF3lQKCYj4TtJuBF VuaA48jGjQf2DgaIlTV1aBLx5pkiomTPD6+cTfUYJ35Mwd+mK58sc8yHK8dB6ClSfWGC/i plwqO9dFXwtRHK62EXPuvvNMeSvGoVs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-KRYqe_RtPRSqmIGvIFbO5A-1; Tue, 09 Apr 2024 19:22:34 -0400 X-MC-Unique: KRYqe_RtPRSqmIGvIFbO5A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1131080B557; Tue, 9 Apr 2024 23:22:34 +0000 (UTC) Received: from localhost (unknown [10.42.28.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id D654E444582; Tue, 9 Apr 2024 23:22:33 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix build for targets without FP std::from_chars [PR114633] Date: Wed, 10 Apr 2024 00:22:00 +0100 Message-ID: <20240409232229.252976-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.7 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 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. Richi confirmed this fixes rx-elf bootstrap. Pushed to trunk. -- >8 -- If the faster std::from_chars is not supported for floating-point types then just extract the value from the stream using operator>>. This fixes a build error for targets where __cpp_lib_to_chars is not defined. libstdc++-v3/ChangeLog: PR libstdc++/114633 * include/bits/chrono_io.h (_Parser::operator()) <'S'>: Use stream extraction if std::from_chars is not available. --- libstdc++-v3/include/bits/chrono_io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index b9eb3d2be53..3b34992b42a 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -3685,6 +3685,7 @@ namespace __detail if (!__is_failed(__err)) [[likely]] { long double __val{}; +#if __cpp_lib_to_chars string __str = std::move(__buf).str(); auto __first = __str.data(); auto __last = __first + __str.size(); @@ -3694,6 +3695,9 @@ namespace __detail if ((bool)ec || ptr != __last) [[unlikely]] __err |= ios_base::failbit; else +#else + if (__buf >> __val) +#endif { duration __fs(__val); if constexpr (__is_floating) -- 2.44.0