diff options
author | Ian Lance Taylor <ian@airs.com> | 2005-08-26 21:52:23 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@gcc.gnu.org> | 2005-08-26 21:52:23 +0000 |
commit | 8f34bde6892a593106ff41c5279ef5b073822e92 (patch) | |
tree | 600becc8488916470260c44d67f6160f51ef224c /gcc/combine.c | |
parent | 277d42e27fa0271ca8cc3cd00607980b5731ed51 (diff) | |
download | gcc-8f34bde6892a593106ff41c5279ef5b073822e92.zip gcc-8f34bde6892a593106ff41c5279ef5b073822e92.tar.gz gcc-8f34bde6892a593106ff41c5279ef5b073822e92.tar.bz2 |
combine.c (make_extraction): Avoid reference outside object.
2005-08-26 Ian Lance Taylor <ian@airs.com>
* combine.c (make_extraction): Avoid reference outside object.
From-SVN: r103537
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 5628e24..57f490d 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6484,11 +6484,13 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos, && GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (is_mode)) offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode); - /* If this is a constant position, we can move to the desired byte. */ + /* If this is a constant position, we can move to the desired byte. + Be careful not to go beyond the original object. */ if (pos_rtx == 0) { - offset += pos / BITS_PER_UNIT; - pos %= GET_MODE_BITSIZE (wanted_inner_mode); + enum machine_mode bfmode = smallest_mode_for_size (len, MODE_INT); + offset += pos / GET_MODE_BITSIZE (bfmode); + pos %= GET_MODE_BITSIZE (bfmode); } if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN |