diff options
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 53 |
1 files changed, 5 insertions, 48 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 1c1ecf2..268a176 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -1026,7 +1026,6 @@ public: if (tb1->ty == TY::Tstruct) { tree t1 = build_expr (e->e1); - tree t2 = convert_for_assignment (e->e2, e->e1->type, true); StructDeclaration *sd = tb1->isTypeStruct ()->sym; /* Look for struct = 0. */ @@ -1051,25 +1050,8 @@ public: else { /* Simple struct literal assignment. */ - tree init = NULL_TREE; - - /* Fill any alignment holes in the struct using memset. */ - if ((e->op == EXP::construct - || (e->e2->op == EXP::structLiteral && e->op == EXP::blit)) - && (sd->isUnionDeclaration () || !identity_compare_p (sd))) - { - t1 = stabilize_reference (t1); - init = build_memset_call (t1); - } - - /* Elide generating assignment if init is all zeroes. */ - if (init != NULL_TREE && initializer_zerop (t2)) - this->result_ = compound_expr (init, t1); - else - { - tree result = build_assign (modifycode, t1, t2); - this->result_ = compound_expr (init, result); - } + tree t2 = convert_for_assignment (e->e2, e->e1->type, true); + this->result_ = build_assign (modifycode, t1, t2); } return; @@ -2685,22 +2667,6 @@ public: if (constant_p && initializer_constant_valid_p (ctor, TREE_TYPE (ctor))) TREE_STATIC (ctor) = 1; - /* Use memset to fill any alignment holes in the array. */ - if (!this->constp_ && !this->literalp_) - { - TypeStruct *ts = etype->baseElemOf ()->isTypeStruct (); - - if (ts != NULL && (!identity_compare_p (ts->sym) - || ts->sym->isUnionDeclaration ())) - { - tree var = build_local_temp (TREE_TYPE (ctor)); - tree init = build_memset_call (var); - /* Evaluate memset() first, then any saved elements. */ - saved_elems = compound_expr (init, saved_elems); - ctor = compound_expr (modify_expr (var, ctor), var); - } - } - this->result_ = compound_expr (saved_elems, d_convert (type, ctor)); } else if (e->onstack) @@ -2726,6 +2692,9 @@ public: tree result = build_memcpy_call (mem, build_address (ctor), size); + /* Fill any alignment holes in the array. */ + result = compound_expr (result, build_clear_padding_call (mem)); + /* Return the array pointed to by MEM. */ result = compound_expr (result, mem); @@ -2899,18 +2868,6 @@ public: tree var = build_deref (e->sym); ctor = compound_expr (modify_expr (var, ctor), var); } - else if (!this->literalp_) - { - /* Use memset to fill any alignment holes in the object. */ - if (!identity_compare_p (e->sd) || e->sd->isUnionDeclaration ()) - { - tree var = build_local_temp (TREE_TYPE (ctor)); - tree init = build_memset_call (var); - /* Evaluate memset() first, then any saved element constructors. */ - saved_elems = compound_expr (init, saved_elems); - ctor = compound_expr (modify_expr (var, ctor), var); - } - } this->result_ = compound_expr (saved_elems, ctor); } |