summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 7e33666dceb..6b654be9c11 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4576,6 +4576,9 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
SET_DECL_DEBUG_EXPR (*from_p, *to_p);
}
+ if (want_value && TREE_THIS_VOLATILE (*to_p))
+ *from_p = get_initialized_tmp_var (*from_p, pre_p, post_p);
+
if (TREE_CODE (*from_p) == CALL_EXPR)
{
/* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL
@@ -4603,7 +4606,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
if (want_value)
{
- *expr_p = unshare_expr (*to_p);
+ *expr_p = TREE_THIS_VOLATILE (*to_p) ? *from_p : unshare_expr (*to_p);
return GS_OK;
}
else