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>
Subject: [PATCH] Make all default vrange setters set VARYING.
Date: Fri, 26 Aug 2022 17:46:38 +0200	[thread overview]
Message-ID: <20220826154638.1156062-1-aldyh@redhat.com> (raw)
Message-ID: <20220826154638.HDIhARUpQ1LcuboSQXoupg4bUSpllMzuTCsQCnQ-_qE@z> (raw)

frange is using some of the default vrange setters, some of which are
leaving the range in an undefined state.  We hadn't noticed this
because neither frange nor unsupported_range, both which use some of
the default implementation, weren't being used much.

We can never go wrong with setting VARYING ;-).

Will commit after tests complete.

gcc/ChangeLog:

	* value-range.cc (vrange::set): Set varying.
	(vrange::set_nonzero): Same.
	(vrange::set_zero): Same.
	(vrange::set_nonnegative): Same.
---
 gcc/value-range.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index d056f7356e1..edd10bf5794 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -94,8 +94,9 @@ vrange::singleton_p (tree *) const
 }
 
 void
-vrange::set (tree, tree, value_range_kind)
+vrange::set (tree min, tree, value_range_kind)
 {
+  set_varying (TREE_TYPE (min));
 }
 
 tree
@@ -168,18 +169,21 @@ vrange::nonzero_p () const
 }
 
 void
-vrange::set_nonzero (tree)
+vrange::set_nonzero (tree type)
 {
+  set_varying (type);
 }
 
 void
-vrange::set_zero (tree)
+vrange::set_zero (tree type)
 {
+  set_varying (type);
 }
 
 void
-vrange::set_nonnegative (tree)
+vrange::set_nonnegative (tree type)
 {
+  set_varying (type);
 }
 
 bool
-- 
2.37.1


             reply	other threads:[~2022-08-26 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 15:46 Aldy Hernandez [this message]
2022-08-26 15:46 ` 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=20220826154638.1156062-1-aldyh@redhat.com \
    --to=aldyh@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).