gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS after gimplifying the...
authorJeff Law <law@redhat.com>
Fri, 25 Jun 2004 18:31:56 +0000 (12:31 -0600)
committerJeff Law <law@gcc.gnu.org>
Fri, 25 Jun 2004 18:31:56 +0000 (12:31 -0600)
        * gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS
        after gimplifying the innermost component.

In

From-SVN: r83670

gcc/ChangeLog
gcc/gimplify.c

index 93329f92785270daea15e929edd405d0ad6a8942..8866356f536b2b84e241c04aa5b6b47da770d5f3 100644 (file)
@@ -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
index a7960fde376733c7105ce4aa0c62c847739a71e7..d34de91c0a3133d839c11015ef55b29dc0634550 100644 (file)
@@ -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)
     {