From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7879) id 455E4385843E; Wed, 15 Feb 2023 10:23:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 455E4385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676456614; bh=7wLpIVxJ6uhZSbzC/JW3WLJfp70RuZWBhN4xz0EFBu0=; h=From:To:Subject:Date:From; b=l5zEd8YYLKo6KihWstdZ4lBv7j867vWcDT7bqFNXEkoTVWPrVtfccUWK7S8MCDuwQ 1b4ZevTxLYgaaCzXtza8e2wtBPmcmBtiyIT80OIsooj0GyPvfXCCxMYQ6ffTbvPejm yVKM+Pyg///IW41Y/Jo3kxYdgI5ck1/JtZjUK71g= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Filip Kastl To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/pheeck/heads/sccp)] libstdc++: Workaround buggy printf on Solaris in to_chars/float128_c++23.cc test [PR107815] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/users/pheeck/heads/sccp X-Git-Oldrev: e6dd9ca6a4661e7daa5df24f7c8497bc372b7ffd X-Git-Newrev: 5e60b9e3dc5745385e3a565a0d4586a421f88ca7 Message-Id: <20230215102334.455E4385843E@sourceware.org> Date: Wed, 15 Feb 2023 10:23:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5e60b9e3dc5745385e3a565a0d4586a421f88ca7 commit 5e60b9e3dc5745385e3a565a0d4586a421f88ca7 Author: Jakub Jelinek Date: Thu Nov 24 10:37:50 2022 +0100 libstdc++: Workaround buggy printf on Solaris in to_chars/float128_c++23.cc test [PR107815] 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. 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. Diff: --- libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc b/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc index 28824c9c6ff..735a507827a 100644 --- a/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc +++ b/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc @@ -52,14 +52,17 @@ test(std::chars_format fmt = std::chars_format{}) 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_format{}) 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{}