summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-28 07:44:34 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-28 07:44:34 +0000
commit6b0e9e4b5c5b235331d464a3f1d8549ca82a1054 (patch)
treeba48970086fccf74bc08fdd978c74b3120c72141 /gcc/expr.c
parent0f063bd6af3f83472721c2a84ebcb6c46e7cbd7b (diff)
downloadgcc-6b0e9e4b5c5b235331d464a3f1d8549ca82a1054.tar.gz
PR middle-end/44790
PR middle-end/44993 * expr.c (expand_expr_real_1) <MEM_REF>: Revert latest change. Make sure the base has address_mode before adding the offset. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162618 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 57f9eff859b..a27dfd8e4ab 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8730,11 +8730,14 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
base = build2 (BIT_AND_EXPR, TREE_TYPE (base),
gimple_assign_rhs1 (def_stmt),
gimple_assign_rhs2 (def_stmt));
+ op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+ op0 = convert_memory_address_addr_space (address_mode, op0, as);
if (!integer_zerop (TREE_OPERAND (exp, 1)))
- base = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base),
- base, double_int_to_tree (sizetype,
- mem_ref_offset (exp)));
- op0 = expand_expr (base, NULL_RTX, address_mode, EXPAND_SUM);
+ {
+ rtx off
+ = immed_double_int_const (mem_ref_offset (exp), address_mode);
+ op0 = simplify_gen_binary (PLUS, address_mode, op0, off);
+ }
op0 = memory_address_addr_space (mode, op0, as);
temp = gen_rtx_MEM (mode, op0);
set_mem_attributes (temp, exp, 0);