Skip to content

Commit bf3469b

Browse files
committed
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.
1 parent 0c88866 commit bf3469b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gcc/value-range.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,8 @@ irange::intersect (const vrange &v)
14751475
return true;
14761476

14771477
res |= intersect_bitmask (r);
1478+
if (res)
1479+
normalize_kind ();
14781480
return res;
14791481
}
14801482

@@ -1574,7 +1576,7 @@ irange::intersect (const vrange &v)
15741576
// Multirange intersect for a specified wide_int [lb, ub] range.
15751577
// Return TRUE if intersect changed anything.
15761578
//
1577-
// NOTE: It is the caller's responsibility to intersect the nonzero masks.
1579+
// NOTE: It is the caller's responsibility to intersect the mask.
15781580

15791581
bool
15801582
irange::intersect (const wide_int& lb, const wide_int& ub)
@@ -1633,7 +1635,8 @@ irange::intersect (const wide_int& lb, const wide_int& ub)
16331635
}
16341636

16351637
m_kind = VR_RANGE;
1636-
normalize_kind ();
1638+
// The caller must normalize and verify the range, as the bitmask
1639+
// still needs to be handled.
16371640
return true;
16381641
}
16391642

0 commit comments

Comments
 (0)