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 2F7213842586 for ; Thu, 24 Nov 2022 09:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F7213842586 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=1669282190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dxhhw2nUzL+6Gaw3rHQVWa7DCy4f+0Wd4qlhPptPWHA=; b=eyXLoJD/HyrN5jMUS5qtrAI0zNsK6MGde4/DxtumThvnto7Nsz/YolpbtTbtS8UNooEU2U TGsabqNttLxc/ecWgvQvLqeRACJo0S2mYyPhB+qDVNRbOwuWytHg2TEaPCW8vuvAISUryE 0e41X5LjBGlAH+ZHk3/bv8bWBzaYp3g= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-634-pp8MhCIlPm2M9iCwJLHvoQ-1; Thu, 24 Nov 2022 04:29:49 -0500 X-MC-Unique: pp8MhCIlPm2M9iCwJLHvoQ-1 Received: by mail-ed1-f72.google.com with SMTP id m13-20020a056402510d00b0046913fa9291so650775edd.6 for ; Thu, 24 Nov 2022 01:29:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dxhhw2nUzL+6Gaw3rHQVWa7DCy4f+0Wd4qlhPptPWHA=; b=7AKHcJHudIquJz6lTyHJf8NhJok2bI7QC/MBrbqWxBr2ciSM0ne2NAPihzwLtc9Ofe SvePdc+6UY9s5ouTQEmSr3Sm7e1F9UuzXGNuf2/OzX/5NpfJgEMkKIzL19aTpBqB+eAa 5T9ApoqRov+mEtuW1fIc3JkmJfBzvQGltK4ODqRvppydqLkhPNJi7B3CVsFySnzoLydL RLQDh2bLyjBCqnO0hNE8EyNFnY4d7nL6RdGkBE1FNaxn1Ns4Qkj4Oh/DvUb+0ihOXFsF FhaE8wbbNic+SnDCPAK5PnLwQ+Zn/v07/Az+6p8L/9e+NCtbU/iV5R1Uy0O3J0Z6Q1zx msmw== X-Gm-Message-State: ANoB5pk+bWIDquN8swVGyMLg8XlR9o+d33rkQm9q0MopOtfqtDOzlW2A OmzQg7lFiw7Y180ocxt9tcbo7uOLl/9Wn70F0D4vQQKpNQExUyLIxA2F1SaEnZqsTLIoBQCDoOr Z0Ek00hO/eHeEkXfFjoOU+ZHxykOvc8M= X-Received: by 2002:a17:906:d103:b0:7ad:9673:8b73 with SMTP id b3-20020a170906d10300b007ad96738b73mr27810197ejz.14.1669282188439; Thu, 24 Nov 2022 01:29:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Nvg4WoBQjyPpp32IvhzCcCxfXlW7a7p/4QFBAlYmMhTlKLgXlFUuh+Tn4Vh1ksq1GrUFRk5w/3ZgW/Jk+DnA= X-Received: by 2002:a17:906:d103:b0:7ad:9673:8b73 with SMTP id b3-20020a170906d10300b007ad96738b73mr27810185ejz.14.1669282188258; Thu, 24 Nov 2022 01:29:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 24 Nov 2022 09:29:37 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Workaround buggy printf on Solaris in to_chars/float128_c++23.cc test [PR107815] To: Jakub Jelinek Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 List-Id: On Thu, 24 Nov 2022 at 09:20, Jakub Jelinek wrote: > > 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? OK, thanks > > 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 >