public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-2760] Clear unused flags in frange for undefined ranges.
Date: Wed, 21 Sep 2022 11:29:10 +0000 (GMT)	[thread overview]
Message-ID: <20220921112910.CC1273858C52@sourceware.org> (raw)

https://gcc.gnu.org/g:324fa420b66bc084dd5b20644c6ee7b35be90c00

commit r13-2760-g324fa420b66bc084dd5b20644c6ee7b35be90c00
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Sep 21 09:49:14 2022 +0200

    Clear unused flags in frange for undefined ranges.
    
    gcc/ChangeLog:
    
            * value-range.cc (frange::combine_zeros): Call set_undefined.
            (frange::intersect_nans): Same.
            (frange::intersect): Same.
            (frange::verify_range): Undefined ranges do not have a type.
            * value-range.h (frange::set_undefined): Clear NAN flags and type.

Diff:
---
 gcc/value-range.cc | 8 ++++----
 gcc/value-range.h  | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index dc42b6d3120..505eb9211a7 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -422,7 +422,7 @@ frange::combine_zeros (const frange &r, bool union_p)
       if (maybe_isnan ())
 	m_kind = VR_NAN;
       else
-	m_kind = VR_UNDEFINED;
+	set_undefined ();
       changed = true;
     }
   return changed;
@@ -506,7 +506,7 @@ frange::intersect_nans (const frange &r)
   if (maybe_isnan ())
     m_kind = VR_NAN;
   else
-    m_kind = VR_UNDEFINED;
+    set_undefined ();
   if (flag_checking)
     verify_range ();
   return true;
@@ -558,7 +558,7 @@ frange::intersect (const vrange &v)
       if (maybe_isnan ())
 	m_kind = VR_NAN;
       else
-	m_kind = VR_UNDEFINED;
+	set_undefined ();
       if (flag_checking)
 	verify_range ();
       return true;
@@ -696,7 +696,7 @@ frange::verify_range ()
   switch (m_kind)
     {
     case VR_UNDEFINED:
-      // m_type is ignored.
+      gcc_checking_assert (!m_type);
       return;
     case VR_VARYING:
       gcc_checking_assert (m_type);
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 325ed08f290..3668b331187 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1083,6 +1083,10 @@ inline void
 frange::set_undefined ()
 {
   m_kind = VR_UNDEFINED;
+  m_type = NULL;
+  m_pos_nan = false;
+  m_neg_nan = false;
+  // m_min and m_min are unitialized as they are REAL_VALUE_TYPE ??.
   if (flag_checking)
     verify_range ();
 }

                 reply	other threads:[~2022-09-21 11:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220921112910.CC1273858C52@sourceware.org \
    --to=aldyh@gcc.gnu.org \
    --cc=gcc-cvs@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).