aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorAdrian Straetling <straetling@de.ibm.com>2005-10-12 20:30:46 +0000
committerIan Lance Taylor <ian@airs.com>2005-10-12 20:30:46 +0000
commit81340300ccad7c90810a60bd02c65ab96dc390bc (patch)
tree7660ea507d7f2bb6251942eadcbc1293734cb064 /gcc/combine.c
parent228f62c9ced55766246e21f164585943b32b2488 (diff)
* combine.c (make_extraction): Correct offset computation.
* gcc.c-torture/execute/20051012-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@105330 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 3be34e4b44d..ff10663a147 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6512,11 +6512,12 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode);
/* If this is a constant position, we can move to the desired byte.
- Be careful not to go beyond the original object. */
+ Be careful not to go beyond the original object and maintain the
+ natural alignment of the memory. */
if (pos_rtx == 0)
{
enum machine_mode bfmode = smallest_mode_for_size (len, MODE_INT);
- offset += pos / GET_MODE_BITSIZE (bfmode);
+ offset += (pos / GET_MODE_BITSIZE (bfmode)) * GET_MODE_SIZE (bfmode);
pos %= GET_MODE_BITSIZE (bfmode);
}