summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 11:57:06 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 11:57:06 +0000
commitdd49bf5f91f0e74a03678323220b65d1c25a359a (patch)
treea81f204a8de862310b14f5428e5f4710b6e94a9d /gcc/tree-ssa-alias.c
parent93792486422cb78463c80bf2e809715073b4a958 (diff)
downloadgcc-dd49bf5f91f0e74a03678323220b65d1c25a359a.tar.gz
gcc/
* tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Avoid signed overflow. Use tree_to_shwi. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index ef9fbfecdc9..a8be8181bd7 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -578,7 +578,7 @@ ao_ref_alias_set (ao_ref *ref)
void
ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
{
- HOST_WIDE_INT t, extra_offset = 0;
+ HOST_WIDE_INT t, size_hwi, extra_offset = 0;
ref->ref = NULL_TREE;
if (TREE_CODE (ptr) == SSA_NAME)
{
@@ -617,9 +617,8 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
ref->offset += extra_offset;
if (size
&& tree_fits_shwi_p (size)
- && TREE_INT_CST_LOW (size) * BITS_PER_UNIT / BITS_PER_UNIT
- == TREE_INT_CST_LOW (size))
- ref->max_size = ref->size = TREE_INT_CST_LOW (size) * BITS_PER_UNIT;
+ && (size_hwi = tree_to_shwi (size)) <= HOST_WIDE_INT_MAX / BITS_PER_UNIT)
+ ref->max_size = ref->size = size_hwi * BITS_PER_UNIT;
else
ref->max_size = ref->size = -1;
ref->ref_alias_set = 0;