public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Hans-Peter Nilsson <hp@axis.com>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++-v3 testsuite: Call fesetround(FE_DOWNWARD) only if defined
Date: Tue, 22 Mar 2022 16:34:51 +0000	[thread overview]
Message-ID: <CACb0b4m+OovR7Je4fdcAztwnpOqnJJyP4nAxd3g32n1Ttb7+kg@mail.gmail.com> (raw)
In-Reply-To: <20220322154159.5116220423@pchp3.se.axis.com>

On Tue, 22 Mar 2022 at 15:48, Hans-Peter Nilsson via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Ok to commit?

OK, thanks.


>
> ----- 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
>


      reply	other threads:[~2022-03-22 16:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 15:41 Hans-Peter Nilsson
2022-03-22 16:34 ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACb0b4m+OovR7Je4fdcAztwnpOqnJJyP4nAxd3g32n1Ttb7+kg@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@axis.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).