on ARRAY_REFs sign-extend offsets only from sizetype's precision [PR98255]
[gcc.git] / gcc / tree-dfa.c
index 648fdd0e0d79474baf90a30afc781d696b6cf97c..0482b05e26cf9dd96a1c6df556d39f1324a68450 100644 (file)
@@ -503,7 +503,7 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset,
                poly_offset_int woffset
                  = wi::sext (wi::to_poly_offset (index)
                              - wi::to_poly_offset (low_bound),
-                             TYPE_PRECISION (TREE_TYPE (index)));
+                             TYPE_PRECISION (sizetype));
                woffset *= wi::to_offset (unit_size);
                woffset <<= LOG2_BITS_PER_UNIT;
                bit_offset += woffset;
@@ -564,7 +564,7 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset,
                      {
                        poly_offset_int woffset
                          = wi::sext (omin - lbound,
-                                     TYPE_PRECISION (TREE_TYPE (index)));
+                                     TYPE_PRECISION (sizetype));
                        woffset *= wi::to_offset (unit_size);
                        woffset <<= LOG2_BITS_PER_UNIT;
                        bit_offset += woffset;
@@ -822,7 +822,7 @@ get_addr_base_and_unit_offset_1 (tree exp, poly_int64_pod *poffset,
            poly_offset_int woffset
                = wi::sext (wi::to_poly_offset (index)
                            - wi::to_poly_offset (low_bound),
-                           TYPE_PRECISION (TREE_TYPE (index)));
+                           TYPE_PRECISION (sizetype));
            woffset *= wi::to_offset (unit_size);
            byte_offset += woffset.force_shwi ();
          }