From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2152) id 4FB923858401; Tue, 22 Mar 2022 21:53:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FB923858401 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Hans-Peter Nilsson To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-7773] libstdc++-v3 testsuite: Call fesetround(FE_DOWNWARD) only if defined X-Act-Checkin: gcc X-Git-Author: Hans-Peter Nilsson X-Git-Refname: refs/heads/master X-Git-Oldrev: 4b7d9f8f51bd96d290aac230c71e501fcb6b21a6 X-Git-Newrev: 5d2233f4033dfa37ad88dc2eab138524fe64242e Message-Id: <20220322215329.4FB923858401@sourceware.org> Date: Tue, 22 Mar 2022 21:53:29 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2022 21:53:29 -0000 https://gcc.gnu.org/g:5d2233f4033dfa37ad88dc2eab138524fe64242e commit r12-7773-g5d2233f4033dfa37ad88dc2eab138524fe64242e Author: Hans-Peter Nilsson Date: Tue Mar 22 22:53:02 2022 +0100 libstdc++-v3 testsuite: Call fesetround(FE_DOWNWARD) only if defined 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: --- libstdc++-v3/testsuite/20_util/from_chars/6.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/from_chars/6.cc b/libstdc++-v3/testsuite/20_util/from_chars/6.cc index d33484cebfe..fff3450b56c 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{} );