aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-04-23 16:40:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-23 16:40:55 +0000
commitbbaba73f06d6ebd6e5b3ed96e7fd40537e3fa489 (patch)
treec50f816477650b4e3cbb25b84c72aae959f07b1b /gcc/gimplify.c
parent3682dc97d6bf818e4c95c734e4d5588a9d9a4cda (diff)
downloadgcc-bbaba73f06d6ebd6e5b3ed96e7fd40537e3fa489.zip
gcc-bbaba73f06d6ebd6e5b3ed96e7fd40537e3fa489.tar.gz
gcc-bbaba73f06d6ebd6e5b3ed96e7fd40537e3fa489.tar.bz2
gimplify.c (gimplify_modify_expr_rhs): Do not do a direct assignment from the constructor either if the target is volatile.
* 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. From-SVN: r146652
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 993f7c2..e491a85 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;