https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113396

--- Comment #31 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc
index cbd3774b21f..1dbd9bd7a00 100644
--- a/gcc/tree-dfa.cc
+++ b/gcc/tree-dfa.cc
@@ -549,7 +549,8 @@ get_ref_base_and_extent (tree exp, poly_int64 *poffset,
                    /* Try to constrain maxsize with range information.  */
                    offset_int omax
                      = offset_int::from (max, TYPE_SIGN (TREE_TYPE (index)));
-                   if (known_lt (lbound, omax))
+                   if (wi::get_precision (max) < ADDR_MAX_PRECISION
+                       && known_lt (lbound, omax))
                      {
                        poly_offset_int rmaxsize;
                        rmaxsize = (omax - lbound + 1)
@@ -567,7 +568,8 @@ get_ref_base_and_extent (tree exp, poly_int64 *poffset,
                    /* Try to adjust bit_offset with range information.  */
                    offset_int omin
                      = offset_int::from (min, TYPE_SIGN (TREE_TYPE (index)));
-                   if (known_le (lbound, omin))
+                   if (wi::get_precision (min) < ADDR_MAX_PRECISION
+                       && known_le (lbound, omin))
                      {
                        poly_offset_int woffset
                          = wi::sext (omin - lbound,


fixes the testcase but I'm not 100% sure the condition is correct.  We
possibly need to cover for the << LOG2_BITS_PER_UNIT done, so maybe
using ADDR_MAX_BITSIZE is better.  I'm going to test a variant with
using <= ADDR_MAX_BITSIZE.

Reply via email to