summaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.h
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-02 11:20:14 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-02 11:20:14 +0000
commit9d95789b82c03bf242379d1d799c8e0c72d81186 (patch)
tree8996b3856e8b5fe78d5f8abc322cbffb9f59af6c /gcc/tree-dfa.h
parente66979705999ce96039f14a3ab82e1d68c72bdec (diff)
downloadgcc-9d95789b82c03bf242379d1d799c8e0c72d81186.tar.gz
PR tree-optimization/59356
* tree-dfa.h (get_addr_base_and_unit_offset_1) <case ARRAY_REF>: Do the offset computation using the precision of the index type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205585 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.h')
-rw-r--r--gcc/tree-dfa.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-dfa.h b/gcc/tree-dfa.h
index 7d0a47009f6..71f2c21965c 100644
--- a/gcc/tree-dfa.h
+++ b/gcc/tree-dfa.h
@@ -102,11 +102,11 @@ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset,
&& (unit_size = array_ref_element_size (exp),
TREE_CODE (unit_size) == INTEGER_CST))
{
- HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index);
-
- hindex -= TREE_INT_CST_LOW (low_bound);
- hindex *= TREE_INT_CST_LOW (unit_size);
- byte_offset += hindex;
+ double_int doffset
+ = (TREE_INT_CST (index) - TREE_INT_CST (low_bound))
+ .sext (TYPE_PRECISION (TREE_TYPE (index)));
+ doffset *= tree_to_double_int (unit_size);
+ byte_offset += doffset.to_shwi ();
}
else
return NULL_TREE;