diff options
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 37 |
1 files changed, 23 insertions, 14 deletions
@@ -3052,6 +3052,8 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, else #endif /* PUSH_ROUNDING */ { + rtx target; + /* Otherwise make space on the stack and copy the data to the address of that space. */ @@ -3086,8 +3088,6 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, skip)); if (current_function_check_memory_usage && ! in_check_memory_usage) { - rtx target; - in_check_memory_usage = 1; target = copy_to_reg (temp); if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type)) @@ -3104,27 +3104,29 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, in_check_memory_usage = 0; } + target = gen_rtx_MEM (BLKmode, temp); + + if (type != 0) + { + set_mem_attributes (target, type, 1); + /* Function incoming arguments may overlap with sibling call + outgoing arguments and we cannot allow reordering of reads + from function arguments with stores to outgoing arguments + of sibling calls. */ + MEM_ALIAS_SET (target) = 0; + } + /* TEMP is the address of the block. Copy the data there. */ if (GET_CODE (size) == CONST_INT && MOVE_BY_PIECES_P ((unsigned) INTVAL (size), align)) { - rtx target = gen_rtx_MEM (BLKmode, temp); - - if (type != 0) - set_mem_attributes (target, type, 1); - - move_by_pieces (gen_rtx_MEM (BLKmode, temp), xinner, - INTVAL (size), align); + move_by_pieces (target, xinner, INTVAL (size), align); goto ret; } else { rtx opalign = GEN_INT (align / BITS_PER_UNIT); enum machine_mode mode; - rtx target = gen_rtx_MEM (BLKmode, temp); - - if (type != 0) - set_mem_attributes (target, type, 1); for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode; @@ -3293,7 +3295,14 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, dest = gen_rtx_MEM (mode, addr); if (type != 0) - set_mem_attributes (dest, type, 1); + { + set_mem_attributes (dest, type, 1); + /* Function incoming arguments may overlap with sibling call + outgoing arguments and we cannot allow reordering of reads + from function arguments with stores to outgoing arguments + of sibling calls. */ + MEM_ALIAS_SET (dest) = 0; + } emit_move_insn (dest, x); |