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 288663830B30 for ; Thu, 24 Nov 2022 09:20:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 288663830B30 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=1669281647; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=aBs43GYF+rwRw23AIvMHQ9RFhfNDSYmLDBX1D7bgZy4=; b=MYalqX5ijLRbCBAmbx9i364IT+lVvTn4znezySpHHAc1d+H1kY1m99U//WAL8mqTUGIgoy MtjeM2ZcSF95IL/dVbbUAa/AFTn1to2DrPglS08atlQDcKnTNEwsp2hBRkFW73TYNyylRU ylOCb7pZmnJpUtGxpF6Ke0jo0IK3DHg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-5uLNYIi6Pse12nfSbtap9g-1; Thu, 24 Nov 2022 04:20:44 -0500 X-MC-Unique: 5uLNYIi6Pse12nfSbtap9g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54F9A185A7A9; Thu, 24 Nov 2022 09:20:44 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15937492B04; Thu, 24 Nov 2022 09:20:43 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AO9KdqR222288 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 10:20:40 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AO9Kc73222287; Thu, 24 Nov 2022 10:20:38 +0100 Date: Thu, 24 Nov 2022 10:20:38 +0100 From: Jakub Jelinek To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Workaround buggy printf on Solaris in to_chars/float128_c++23.cc test [PR107815] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,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: Hi! As mentioned in the PR, Solaris apparently can handle right printf ("%.0Lf\n", 1e+202L * __DBL_MAX__); which prints 511 chars long number, but can't handle printf ("%.0Lf\n", 1e+203L * __DBL_MAX__); nor printf ("%.0Lf\n", __LDBL_MAX__); properly, instead of printing 512 chars long number for the former and 4933 chars long number for the second, it handles them as if user asked for "%.0Le\n" in those cases. The following patch disables the single problematic value that fails in the test, and also fixes commented out debugging printouts. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-11-24 Jakub Jelinek PR libstdc++/107815 * testsuite/20_util/to_chars/float128_c++23.cc (test): Disable __FLT128_MAX__ test on Solaris. Fix up commented out debugging printouts. --- libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc.jj 2022-11-08 11:19:22.251768167 +0100 +++ libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc 2022-11-23 17:02:22.380051796 +0100 @@ -52,14 +52,17 @@ test(std::chars_format fmt = std::chars_ std::numbers::inv_sqrt3_v, std::numbers::egamma_v, std::numbers::phi_v, +// Solaris has non-conforming printf, see PR98384 and PR107815. +#if !(defined(__sun__) && defined(__svr4__)) std::numeric_limits::max() +#endif }; char str1[10000], str2[10000]; for (auto u : tests) { auto [ptr1, ec1] = std::to_chars(str1, str1 + sizeof(str1), u, fmt); VERIFY( ec1 == std::errc() ); -// std::cout << i << ' ' << std::string_view (str1, ptr1) << '\n'; +// std::cout << u << ' ' << std::string_view (str1, ptr1) << '\n'; if (fmt == std::chars_format::fixed) { auto [ptr2, ec2] = std::to_chars(str2, str2 + (ptr1 - str1), u, fmt); @@ -76,7 +79,7 @@ test(std::chars_format fmt = std::chars_ auto [ptr5, ec5] = std::to_chars(str1, str1 + sizeof(str1), u, fmt, 90); VERIFY( ec5 == std::errc() ); -// std::cout << i << ' ' << std::string_view (str1, ptr5) << '\n'; +// std::cout << u << ' ' << std::string_view (str1, ptr5) << '\n'; v = 4.0f128; auto [ptr6, ec6] = std::from_chars(str1, ptr5, v, fmt == std::chars_format{} Jakub