public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Do not double print INF and NAN in frange pretty printer.
Date: Thu,  6 Oct 2022 08:23:16 +0200	[thread overview]
Message-ID: <20221006062318.1709996-1-aldyh@redhat.com> (raw)

gcc/ChangeLog:

	* value-range-pretty-print.cc (vrange_printer::print_real_value):
	Avoid printing INF and NAN twice.
---
 gcc/value-range-pretty-print.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
index 8cbe97b76fd..3a3b4b44cbd 100644
--- a/gcc/value-range-pretty-print.cc
+++ b/gcc/value-range-pretty-print.cc
@@ -123,7 +123,11 @@ vrange_printer::print_real_value (tree type, const REAL_VALUE_TYPE &r) const
   char s[100];
   real_to_decimal_for_mode (s, &r, sizeof (s), 0, 1, TYPE_MODE (type));
   pp_string (pp, s);
-  if (!DECIMAL_FLOAT_TYPE_P (type))
+  if (!DECIMAL_FLOAT_TYPE_P (type)
+      // real_to_hexadecimal prints infinities and NAN as text.  No
+      // need to print them twice.
+      && !real_isinf (&r)
+      && !real_isnan (&r))
     {
       real_to_hexadecimal (s, &r, sizeof (s), 0, 1);
       pp_printf (pp, " (%s)", s);
-- 
2.37.1


             reply	other threads:[~2022-10-06  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06  6:23 Aldy Hernandez [this message]
2022-10-06  6:23 ` [COMMITTED] Do not check finite_operands_p twice in range-ops-float Aldy Hernandez
2022-10-06  6:23 ` [COMMITTED] Setting explicit NANs sets UNDEFINED for -ffinite-math-only Aldy Hernandez

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=20221006062318.1709996-1-aldyh@redhat.com \
    --to=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@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).