diff options
Diffstat (limited to 'gcc-4.9/gcc/expr.c')
-rw-r--r-- | gcc-4.9/gcc/expr.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc-4.9/gcc/expr.c b/gcc-4.9/gcc/expr.c index ad8c05a90..8559d5146 100644 --- a/gcc-4.9/gcc/expr.c +++ b/gcc-4.9/gcc/expr.c @@ -7630,11 +7630,13 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode, break; case COMPOUND_LITERAL_EXPR: - /* Allow COMPOUND_LITERAL_EXPR in initializers, if e.g. - rtl_for_decl_init is called on DECL_INITIAL with - COMPOUNT_LITERAL_EXPRs in it, they aren't gimplified. */ - if (modifier == EXPAND_INITIALIZER - && COMPOUND_LITERAL_EXPR_DECL (exp)) + /* Allow COMPOUND_LITERAL_EXPR in initializers or coming from + initializers, if e.g. rtl_for_decl_init is called on DECL_INITIAL + with COMPOUND_LITERAL_EXPRs in it, or ARRAY_REF on a const static + array with address of COMPOUND_LITERAL_EXPR in DECL_INITIAL; + the initializers aren't gimplified. */ + if (COMPOUND_LITERAL_EXPR_DECL (exp) + && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp))) return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp), target, tmode, modifier, as); /* FALLTHRU */ @@ -10004,7 +10006,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset, &mode1, &unsignedp, &volatilep, true); rtx orig_op0, memloc; - bool mem_attrs_from_type = false; + bool clear_mem_expr = false; /* If we got back the original object, something is wrong. Perhaps we are evaluating an expression too early. In any event, don't @@ -10100,7 +10102,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, memloc = assign_temp (TREE_TYPE (tem), 1, 1); emit_move_insn (memloc, op0); op0 = memloc; - mem_attrs_from_type = true; + clear_mem_expr = true; } if (offset) @@ -10285,17 +10287,17 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (op0 == orig_op0) op0 = copy_rtx (op0); - /* If op0 is a temporary because of forcing to memory, pass only the - type to set_mem_attributes so that the original expression is never - marked as ADDRESSABLE through MEM_EXPR of the temporary. */ - if (mem_attrs_from_type) - set_mem_attributes (op0, type, 0); - else - set_mem_attributes (op0, exp, 0); + set_mem_attributes (op0, exp, 0); if (REG_P (XEXP (op0, 0))) mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0)); + /* If op0 is a temporary because the original expressions was forced + to memory, clear MEM_EXPR so that the original expression cannot + be marked as addressable through MEM_EXPR of the temporary. */ + if (clear_mem_expr) + set_mem_expr (op0, NULL_TREE); + MEM_VOLATILE_P (op0) |= volatilep; if (mode == mode1 || mode1 == BLKmode || mode1 == tmode || modifier == EXPAND_CONST_ADDRESS @@ -10681,7 +10683,7 @@ is_aligning_offset (const_tree offset, const_tree exp) || !tree_fits_uhwi_p (TREE_OPERAND (offset, 1)) || compare_tree_int (TREE_OPERAND (offset, 1), BIGGEST_ALIGNMENT / BITS_PER_UNIT) <= 0 - || !exact_log2 (tree_to_uhwi (TREE_OPERAND (offset, 1)) + 1) < 0) + || exact_log2 (tree_to_uhwi (TREE_OPERAND (offset, 1)) + 1) < 0) return 0; /* Look at the first operand of BIT_AND_EXPR and strip any conversion. |