Fix 20030709-2.c
Jeffrey A Law
law@redhat.com
Fri Jun 25 19:15:00 GMT 2004
gcc.dg/tree-ssa/20030709-2.c has recently started failing. It appears
that a change was checked in which was not properly regression tested.
This patch fixes 20030709-2.c by ensuring that after we gimplify
the innermost object in a compound lvalue that we recompute
TREE_SIDE_EFFECTS for the components in the compound lvalue.
Bootstrapped and regression tested on i686-pc-linux-gnu.
-------------- next part --------------
* gimplify.c (gimplify_compound_lval): Reset TREE_SIDE_EFFECTS
after gimplifying the innermost component.
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.31
diff -c -p -r2.31 gimplify.c
*** gimplify.c 25 Jun 2004 03:46:30 -0000 2.31
--- gimplify.c 25 Jun 2004 18:17:41 -0000
*************** gimplify_compound_lval (tree *expr_p, tr
*** 1942,1947 ****
--- 1942,1963 ----
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)
{
More information about the Gcc-patches
mailing list