public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3102] Do not double print INF and NAN in frange pretty printer.
@ 2022-10-06  6:23 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-06  6:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ab4909fd8f5f77685e6ec12768c56545347f30c4

commit r13-3102-gab4909fd8f5f77685e6ec12768c56545347f30c4
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Oct 5 20:21:07 2022 +0200

    Do not double print INF and NAN in frange pretty printer.
    
    gcc/ChangeLog:
    
            * value-range-pretty-print.cc (vrange_printer::print_real_value):
            Avoid printing INF and NAN twice.

Diff:
---
 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-06  6:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  6:23 [gcc r13-3102] Do not double print INF and NAN in frange pretty printer Aldy Hernandez

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