From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id AFB713858407; Tue, 22 Mar 2022 15:47:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AFB713858407 From: Hans-Peter Nilsson To: , Subject: [PATCH] libstdc++-v3 testsuite: Call fesetround(FE_DOWNWARD) only if defined MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Message-ID: <20220322154159.5116220423@pchp3.se.axis.com> Date: Tue, 22 Mar 2022 16:41:59 +0100 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2022 15:47:32 -0000 Ok to commit? ----- 8< ----- Without this, for a typical soft-float target such as cris-elf, after commit r12-7676-g5a4e208022e704 you'll see, in libstdc++.log: ... FAIL: 20_util/from_chars/6.cc (test for excess errors) Excess errors: /home/hp/tmp/auto0321/gcc/libstdc++-v3/testsuite/20_util/from_chars/6.cc:33: error: 'FE_DOWNWARD' was not declared in this scope UNRESOLVED: 20_util/from_chars/6.cc compilation failed to produce executable ... It appears to be a side-effect of that commit changing the way __cpp_lib_to_chars is defined. (On the bright side, ./7.cc now passes since that commit.) TFM, specifically fenv(3), says that "Each of the macros FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, FE_UNDERFLOW is defined when the implementation supports handling of the corresponding exception". A git-grep shows that this was the only place using a FE_ macro unconditionally. libstdc++-v3: * testsuite/20_util/from_chars/6.cc (test01) [FE_DOWNWARD]: Conditionalize call to fesetround. diff --git a/libstdc++-v3/testsuite/20_util/from_chars/6.cc b/libstdc++-v3/testsuite/20_util/from_chars/6.cc index d33484cebfee..fff3450b56c9 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/6.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/6.cc @@ -30,7 +30,9 @@ test01() #if __cpp_lib_to_chars >= 201611L #if _GLIBCXX_USE_C99_FENV_TR1 double d; +#ifdef FE_DOWNWARD std::fesetround(FE_DOWNWARD); +#endif const std::string s = "0.099999999999999999999999999"; auto res = std::from_chars(s.data(), s.data() + s.length(), d); VERIFY( res.ec == std::errc{} ); -- 2.30.2