aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-06-30 20:24:38 +0200
committerAldy Hernandez <aldyh@redhat.com>2023-07-07 09:55:58 +0200
commitbf3469b6474f6cff168c1e9171879d29a8296fae (patch)
tree29ea51451a71f5099c573b1caa7170cece6f534f
parent0c888665dfbd5175256c674ee82d85bd0f7450f7 (diff)
downloadgcc-bf3469b6474f6cff168c1e9171879d29a8296fae.zip
gcc-bf3469b6474f6cff168c1e9171879d29a8296fae.tar.gz
gcc-bf3469b6474f6cff168c1e9171879d29a8296fae.tar.bz2
The caller to irange::intersect (wide_int, wide_int) must normalize the range.
Per the function comment, the caller to intersect(wide_int, wide_int) must handle the mask. This means it must also normalize the range if anything changed. gcc/ChangeLog: * value-range.cc (irange::intersect): Leave normalization to caller.
-rw-r--r--gcc/value-range.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 8e5607a..fbc0c7a 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -1475,6 +1475,8 @@ irange::intersect (const vrange &v)
return true;
res |= intersect_bitmask (r);
+ if (res)
+ normalize_kind ();
return res;
}
@@ -1574,7 +1576,7 @@ irange::intersect (const vrange &v)
// Multirange intersect for a specified wide_int [lb, ub] range.
// Return TRUE if intersect changed anything.
//
-// NOTE: It is the caller's responsibility to intersect the nonzero masks.
+// NOTE: It is the caller's responsibility to intersect the mask.
bool
irange::intersect (const wide_int& lb, const wide_int& ub)
@@ -1633,7 +1635,8 @@ irange::intersect (const wide_int& lb, const wide_int& ub)
}
m_kind = VR_RANGE;
- normalize_kind ();
+ // The caller must normalize and verify the range, as the bitmask
+ // still needs to be handled.
return true;
}