diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c9b75ac9b9..b4aa73ebee4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-04-07 Richard Guenther + + PR middle-end/42617 + * expr.c (expand_expr_real_1): For TARGET_MEM_REFs with + pointer bases build simple mem attributes to retain + points-to information. + 2010-04-07 Richard Guenther PR middle-end/42617 diff --git a/gcc/expr.c b/gcc/expr.c index ad66d934d2f..1f04ffb3bb4 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8730,6 +8730,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, { addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (exp)); struct mem_address addr; + tree base; get_address_description (exp, &addr); op0 = addr_for_mem_ref (&addr, as, true); @@ -8737,6 +8738,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, temp = gen_rtx_MEM (mode, op0); set_mem_attributes (temp, TMR_ORIGINAL (exp), 0); set_mem_addr_space (temp, as); + base = get_base_address (TMR_ORIGINAL (exp)); + if (INDIRECT_REF_P (base) + && TMR_BASE (exp) + && TREE_CODE (TMR_BASE (exp)) == SSA_NAME + && POINTER_TYPE_P (TREE_TYPE (TMR_BASE (exp)))) + { + set_mem_expr (temp, build1 (INDIRECT_REF, + TREE_TYPE (exp), TMR_BASE (exp))); + set_mem_offset (temp, NULL_RTX); + } } return temp;