From patchwork Thu Nov 24 09:20:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 25400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3282998wrr; Thu, 24 Nov 2022 01:22:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5vR0QijYey1POPF3P6yRVHldtyfpvWjRPy+cJRWse+6C/xTMWA5SUhYWNvNEuULoIlk5+j X-Received: by 2002:aa7:c84d:0:b0:468:354b:280d with SMTP id g13-20020aa7c84d000000b00468354b280dmr29754732edt.178.1669281723233; Thu, 24 Nov 2022 01:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669281723; cv=none; d=google.com; s=arc-20160816; b=OVnFRMIHdKnpg8dVRUtoMX6g045YKmtpD56AaLkFuYDdE+F9dIlyHlo9MHBKE/fz7Q o5WVxFlI+U5YVlVMhWosQET1joYw0Ztv1/RLqQlS5B9oB9nWkM5e93GfKYtR4LEAAlj5 I6rmaXbpCGrRmRgD0usxAnrhuys6AUx65ube7rStpeCs0/RfVdBP7xeSOpnFTs1zJK0t oLULBx9i3SEnpRkD/ZcQ8vazogt/BI1CobGFES7myinU02hom7EpQifvmGv4g+w1Xvkc VE0w6ETONEZf0BKr6wTB7Q+HiL8G2ZWbzIoYDYCnytBARDVmsu5eoHO8rZgGUrT0PR/8 Sf4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=aBs43GYF+rwRw23AIvMHQ9RFhfNDSYmLDBX1D7bgZy4=; b=bgtxXpMqvEpf4iie5atxximGhgkuNdkiJeJb4g74/MpgEaQlY6R6GuX0R8l6BF2ddZ Ue3Zpw5YUBT25TmHXd2vcXxZf28LO37b3krvE7oSK6nZ7ihjTG50ZOi8LNaSLa+WzHYP RfbPZ3t5SMcL1SBFsfzUeNQQcWqxhJs92st7huQxGPakmQqPEy3lNuwb4/eu+tEoWC9y VSQXenpOj0o3mgp15KQs60E6z3w9HFqR6Hd0YWKjuYZIDbQzCdR8P+qJrJyinamjyNzh mog79u082ZbARtI2TZpl/imUVmK88jSPrIh5uiJSjTWFTLd6kkLkDlicxZk/Y4DVNdxk uwMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="izp/4Bkw"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ne28-20020a1709077b9c00b007882926c090si488038ejc.773.2022.11.24.01.22.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 01:22:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="izp/4Bkw"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 00EAA382FCBD for ; Thu, 24 Nov 2022 09:21:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00EAA382FCBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669281692; bh=aBs43GYF+rwRw23AIvMHQ9RFhfNDSYmLDBX1D7bgZy4=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=izp/4BkwOxJLHd4LNSC8TGSAoPPnBIYASeMZ32EZmdA7Tbk7Lv4px+SRYbmooM7Sl nP/dJqkCt9S4jB2poIFWjVbPVqF7i7wHakbVlcOfE/8J2JKi0JrMjDhOeWswgdBVwr B8K+9JIny3ucQoRtHSA3ecR/9DwgHWbr6ajOVxD8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 9B3203839C5A for ; Thu, 24 Nov 2022 09:20:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B3203839C5A 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 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: 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-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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750368752288492482?= X-GMAIL-MSGID: =?utf-8?q?1750368752288492482?= 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. Jakub --- 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{}