aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2004-06-25 12:31:56 -0600
committerJeff Law <law@gcc.gnu.org>2004-06-25 12:31:56 -0600
commit71f85957b6ec652431ca32b7de602167180b7fe0 (patch)
tree897ce7da8e802ab34db5d7f0cf89f098137ad970 /gcc
parent75822272d9f74ec95289fe8dd74944c383c14348 (diff)
downloadgcc-71f85957b6ec652431ca32b7de602167180b7fe0.zip
gcc-71f85957b6ec652431ca32b7de602167180b7fe0.tar.gz
gcc-71f85957b6ec652431ca32b7de602167180b7fe0.tar.bz2
gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS after gimplifying the innermost component.
* gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS after gimplifying the innermost component. In From-SVN: r83670
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimplify.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 93329f9..8866356 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-24 Jeff Law <law@redhat.com>
+
+ * gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS
+ after gimplifying the innermost component.
+
2004-06-25 Richard Sandiford <rsandifo@redhat.com>
PR target/16176
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a7960fd..d34de91 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1942,6 +1942,22 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
want_lvalue ? fb_lvalue : fb_rvalue);
ret = MIN (ret, tret);
+ /* The innermost expression P may have originally had TREE_SIDE_EFFECTS
+ set which would have caused all the outer expressions in EXPR_P leading
+ to P to also have had TREE_SIDE_EFFECTS set.
+
+ Gimplification of P may have cleared TREE_SIDE_EFFECTS on P, which should
+ be propagated to P's parents, innermost to outermost. */
+ for (p = expr_p; handled_component_p (*p); p = &TREE_OPERAND (*p, 0))
+ VARRAY_PUSH_TREE (stack, *p);
+
+ for (; VARRAY_ACTIVE_SIZE (stack) > 0; )
+ {
+ tree t = VARRAY_TOP_TREE (stack);
+ recalculate_side_effects (t);
+ VARRAY_POP (stack);
+ }
+
/* If the outermost expression is a COMPONENT_REF, canonicalize its type. */
if (!want_lvalue && TREE_CODE (*expr_p) == COMPONENT_REF)
{