This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: tree-ssa branch broken
Graham, Dan,
Thanks for the detective work. It seems to be another sharing
problem. Please try this, still untested, patch:
* c-simplify.c (simplify_decl_stmt): Unshare the
initializer nodes before simplification.
Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.2
diff -d -u -p -r1.1.4.2 c-simplify.c
--- c-simplify.c 29 Jun 2002 18:08:01 -0000 1.1.4.2
+++ c-simplify.c 2 Jul 2002 15:29:06 -0000
@@ -957,10 +957,15 @@ simplify_decl_stmt (t, pre_p, mid_p, pos
if (DECL_SIZE_UNIT (decl)
&& TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST)
- simplify_expr (&DECL_SIZE_UNIT (decl), pre_p, &post, is_simple_val,
- fb_rvalue);
+ {
+ walk_tree (&DECL_SIZE_UNIT (decl), mostly_copy_tree_r, NULL, NULL);
+ simplify_expr (&DECL_SIZE_UNIT (decl), pre_p, &post, is_simple_val,
+ fb_rvalue);
+ }
+
if (init)
{
+ walk_tree (&init, mostly_copy_tree_r, NULL, NULL);
simplify_expr (&init, &mid, &post, is_simple_initializer, fb_rvalue);
init = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
add_tree (mid, mid_p);