https://gcc.gnu.org/g:0cc1f282d5bc63745cb3b873c532c2e6d0aa25bf
commit r13-10254-g0cc1f282d5bc63745cb3b873c532c2e6d0aa25bf Author: Richard Biener <[email protected]> Date: Thu Apr 9 10:41:32 2026 +0200 Revert "ipa/116296 - avoid overflow in modref_access_node::contains" This reverts commit 962402d55c6086d4996eb39ea34c572c4b863e6e. Diff: --- gcc/ipa-modref-tree.cc | 15 +++++---------- gcc/testsuite/gcc.dg/torture/pr116296.c | 9 --------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/gcc/ipa-modref-tree.cc b/gcc/ipa-modref-tree.cc index 5d91dc442415..de89d879bf4e 100644 --- a/gcc/ipa-modref-tree.cc +++ b/gcc/ipa-modref-tree.cc @@ -59,7 +59,7 @@ modref_access_node::operator == (modref_access_node &a) const bool modref_access_node::contains (const modref_access_node &a) const { - poly_offset_int aoffset_adj = 0; + poly_int64 aoffset_adj = 0; if (parm_index != MODREF_UNKNOWN_PARM) { if (parm_index != a.parm_index) @@ -80,8 +80,7 @@ modref_access_node::contains (const modref_access_node &a) const a.offset may result in non-negative offset again. Ubsan fails on val << LOG_BITS_PER_UNIT where val is negative. */ - aoffset_adj = (poly_offset_int::from (a.parm_offset, SIGNED) - - poly_offset_int::from (parm_offset, SIGNED)) + aoffset_adj = (a.parm_offset - parm_offset) * BITS_PER_UNIT; } } @@ -97,14 +96,10 @@ modref_access_node::contains (const modref_access_node &a) const || !known_le (size, a.size))) return false; if (known_size_p (max_size)) - return known_subrange_p (poly_offset_int::from (a.offset, SIGNED) - + aoffset_adj, a.max_size, - poly_offset_int::from (offset, SIGNED), - max_size); + return known_subrange_p (a.offset + aoffset_adj, + a.max_size, offset, max_size); else - return known_le (poly_offset_int::from (offset, SIGNED), - poly_offset_int::from (a.offset, SIGNED) - + aoffset_adj); + return known_le (offset, a.offset + aoffset_adj); } return true; } diff --git a/gcc/testsuite/gcc.dg/torture/pr116296.c b/gcc/testsuite/gcc.dg/torture/pr116296.c deleted file mode 100644 index 4170a1011dc3..000000000000 --- a/gcc/testsuite/gcc.dg/torture/pr116296.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-require-effective-target int32plus } */ - -short g(unsigned long h, int i[11][11], short c) -{ - for (unsigned long j = 0; j < h; j -= 0x105f000000000000ull) - c = c > i[j][j]; - return c; -}
