When performing an intersection, if a one Prange points to a specific
object, and the other Prange points away from the same object, the
result is UNDEFINED.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed.
Andrew
From 0f0e8a41232aa196c0c1691cde2d307934deeb41 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <[email protected]>
Date: Thu, 18 Jun 2026 11:03:05 -0400
Subject: [PATCH 3/3] pointsr-to and points-away intersected result is
undefined.
when performing an intersection, pointing-to an object and away-from
an object now results in an UNDEFINED value.
* value-range.cc (prange::intersect): Points-to and away results
in undefined.
---
gcc/value-range.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 488feb5ca0f..86eb2f507fb 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -788,6 +788,13 @@ prange::intersect (const vrange &v)
return true;
}
+ // If this points to and away, results are undefined,
+ if (pt_inverted_p (r))
+ {
+ set_undefined ();
+ return true;
+ }
+
prange save = *this;
m_min = wi::max (r.lower_bound (), lower_bound (), UNSIGNED);
m_max = wi::min (r.upper_bound (), upper_bound (), UNSIGNED);
--
2.45.0