summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-01 12:15:08 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-01 12:15:08 +0000
commit9ec012cbf249e8c00c4fa51358dfafe07159c36b (patch)
tree2007e1650009708b5fc84ff70fa3d964c0926435 /gcc/gimplify.c
parent0591727a9d083d76618d8a57926932e63b0434d3 (diff)
downloadgcc-9ec012cbf249e8c00c4fa51358dfafe07159c36b.tar.gz
* gimplify.c (gimplify_init_constructor): Do not create a temporary for
a volatile LHS if the constructor has only one element. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 52d83f656fb..b0468c6856b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3824,11 +3824,12 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
}
}
- /* If the target is volatile and we have non-zero elements
- initialize the target from a temporary. */
+ /* If the target is volatile, we have non-zero elements and more than
+ one field to assign, initialize the target from a temporary. */
if (TREE_THIS_VOLATILE (object)
&& !TREE_ADDRESSABLE (type)
- && num_nonzero_elements > 0)
+ && num_nonzero_elements > 0
+ && VEC_length (constructor_elt, elts) > 1)
{
tree temp = create_tmp_var (TYPE_MAIN_VARIANT (type), NULL);
TREE_OPERAND (*expr_p, 0) = temp;