diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-23 16:40:55 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-23 16:40:55 +0000 |
commit | 7fd3f504416286edc2584ec8099490432443ceb6 (patch) | |
tree | c50f816477650b4e3cbb25b84c72aae959f07b1b /gcc/gimplify.c | |
parent | 99151707982f2e28ea809036b7ee310c42c861ba (diff) | |
download | gcc-7fd3f504416286edc2584ec8099490432443ceb6.tar.gz |
* gimplify.c (gimplify_modify_expr_rhs) <VAR_DECL>: Do not do a direct
assignment from the constructor either if the target is volatile.
ada/
* einfo.ads (Is_True_Constant): Lift restriction on atomic objects.
* sinfo.ads (Object Declaration): Likewise.
(Assignment Statement): Likewise.
* freeze.adb (Expand_Atomic_Aggregate): Remove useless test.
Do not force Is_True_Constant to false on the temporary.
(Freeze_Entity): Do not force Is_True_Constant to false on names on
the RHS of object declarations.
* gcc-interface/trans.c (lvalue_required_p) <N_Object_Declaration>:
New case. Return 1 if the object is atomic.
<N_Assignment_Statement>: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146652 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 993f7c2ae44..e491a851c5b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3982,11 +3982,14 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, switch (TREE_CODE (*from_p)) { case VAR_DECL: - /* If we're assigning from a constant constructor, move the - constructor expression to the RHS of the MODIFY_EXPR. */ + /* If we're assigning from a read-only variable initialized with + a constructor, do the direct assignment from the constructor, + but only if neither source nor target are volatile since this + latter assignment might end up being done on a per-field basis. */ if (DECL_INITIAL (*from_p) && TREE_READONLY (*from_p) && !TREE_THIS_VOLATILE (*from_p) + && !TREE_THIS_VOLATILE (*to_p) && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR) { tree old_from = *from_p; |