summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2019-11-04 21:41:12 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2019-11-04 21:41:12 +0000
commit8ced1d76b143b6856699f815813045d551e3cef9 (patch)
treed70528682f093bb308726e1a647bda8b36090b30 /gcc/tree-vrp.c
parenta1b680597178df866e6de80444695fab82b90492 (diff)
Use the value_range_base constructors in value_range_base::invert to
make sure we build canonically correct ranges. From-SVN: r277794
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 070db903147..085308e519f 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6286,10 +6286,12 @@ value_range_base::contains_p (tree cst) const
void
value_range_base::invert ()
{
+ /* We can't just invert VR_RANGE and VR_ANTI_RANGE because we may
+ create non-canonical ranges. Use the constructors instead. */
if (m_kind == VR_RANGE)
- m_kind = VR_ANTI_RANGE;
+ *this = value_range_base (VR_ANTI_RANGE, m_min, m_max);
else if (m_kind == VR_ANTI_RANGE)
- m_kind = VR_RANGE;
+ *this = value_range_base (VR_RANGE, m_min, m_max);
else
gcc_unreachable ();
}