aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 2918c46..8a1875d 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -5466,6 +5466,7 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
/* If source is a constant VAR_DECL with a simple constructor,
store the constructor to the stack instead of moving it. */
const_tree decl;
+ HOST_WIDE_INT sz;
if (partial == 0
&& MEM_P (xinner)
&& SYMBOL_REF_P (XEXP (xinner, 0))
@@ -5473,9 +5474,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
&& VAR_P (decl)
&& TREE_READONLY (decl)
&& !TREE_SIDE_EFFECTS (decl)
- && immediate_const_ctor_p (DECL_INITIAL (decl), 2))
- store_constructor (DECL_INITIAL (decl), target, 0,
- int_expr_size (DECL_INITIAL (decl)), false);
+ && immediate_const_ctor_p (DECL_INITIAL (decl), 2)
+ && (sz = int_expr_size (DECL_INITIAL (decl))) > 0
+ && CONST_INT_P (size)
+ && INTVAL (size) == sz)
+ store_constructor (DECL_INITIAL (decl), target, 0, sz, false);
else
emit_block_move (target, xinner, size, BLOCK_OP_CALL_PARM);
}