]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not double print INF and NAN in frange pretty printer.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 5 Oct 2022 18:21:07 +0000 (20:21 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 6 Oct 2022 06:21:41 +0000 (08:21 +0200)
gcc/ChangeLog:

* value-range-pretty-print.cc (vrange_printer::print_real_value):
Avoid printing INF and NAN twice.

gcc/value-range-pretty-print.cc

index 8cbe97b76fd50dd62217c1592d9c88b0bf7713ab..3a3b4b44cbdb229523c3ce79f4d53b397e96ac15 100644 (file)
@@ -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);