diff options
author | Richard Guenther <rguenther@suse.de> | 2011-08-18 08:33:21 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-08-18 08:33:21 +0000 |
commit | 97919ae7b65c192b0fdb6dfa6abdebd63a3f4ba9 (patch) | |
tree | 72321f7542701e8f11e627c812fb466857e6393f /gcc/expr.c | |
parent | 55715096b51c2cb7e9a9cd03bd562301b7867051 (diff) | |
download | gcc-97919ae7b65c192b0fdb6dfa6abdebd63a3f4ba9.zip gcc-97919ae7b65c192b0fdb6dfa6abdebd63a3f4ba9.tar.gz gcc-97919ae7b65c192b0fdb6dfa6abdebd63a3f4ba9.tar.bz2 |
expr.c (get_inner_reference): Sign-extend the constant twos-complement offset before doing arbitrary...
2011-08-18 Richard Guenther <rguenther@suse.de>
* expr.c (get_inner_reference): Sign-extend the constant
twos-complement offset before doing arbitrary precision
arithmetic on it.
* tree-ssa-structalias.c (get_constraint_for_ptr_offset): Likewise.
(get_constraint_for_1): Pass the offset of a MEM_REF unchanged
to get_constraint_for_ptr_offset.
From-SVN: r177847
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -6502,12 +6502,14 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, /* If OFFSET is constant, see if we can return the whole thing as a constant bit position. Make sure to handle overflow during this conversion. */ - if (host_integerp (offset, 0)) - { - double_int tem = double_int_lshift (tree_to_double_int (offset), - BITS_PER_UNIT == 8 - ? 3 : exact_log2 (BITS_PER_UNIT), - HOST_BITS_PER_DOUBLE_INT, true); + if (TREE_CODE (offset) == INTEGER_CST) + { + double_int tem = tree_to_double_int (offset); + tem = double_int_sext (tem, TYPE_PRECISION (sizetype)); + tem = double_int_lshift (tree_to_double_int (offset), + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true); tem = double_int_add (tem, bit_offset); if (double_int_fits_in_shwi_p (tem)) { |