This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix bug tree-optimization/26443


VRP can sometimes constant propagate results into array indices,
changing the TMT usage.

Fixed by telling the pass manager it destroys tmt usage, and needs an
update at the end.


Bootstrapped and regtested on i686-pc-linux-gnu.

Okay for mainline?

--Dan
2006-02-27  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR tree-optimization/26443 

	* tree-vrp.c (pass_vrp): This pass destroys TMT usage info,
	and thus, needs to recalculate it as a TODO.

Index: tree-vrp.c
===================================================================
--- tree-vrp.c	(revision 111486)
+++ tree-vrp.c	(working copy)
@@ -4631,12 +4631,13 @@ struct tree_opt_pass pass_vrp =
   TV_TREE_VRP,				/* tv_id */
   PROP_ssa | PROP_alias,		/* properties_required */
   0,					/* properties_provided */
-  0,					/* properties_destroyed */
+  PROP_tmt_usage,					/* properties_destroyed */
   0,					/* todo_flags_start */
   TODO_cleanup_cfg
     | TODO_ggc_collect
     | TODO_verify_ssa
     | TODO_dump_func
-    | TODO_update_ssa,			/* todo_flags_finish */
+    | TODO_update_ssa
+    | TODO_update_tmt_usage,			/* todo_flags_finish */
   0					/* letter */
 };
Index: testsuite/g++.dg/tree-ssa/pr26443.C
===================================================================
--- testsuite/g++.dg/tree-ssa/pr26443.C	(revision 0)
+++ testsuite/g++.dg/tree-ssa/pr26443.C	(revision 0)
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+struct A
+{
+    double x[4];
+};
+
+struct B
+{
+    A y[2];
+};
+
+A foo(B *p)
+{
+    for ( int i=0; i<4; ++i )
+        p->y[1].x[i]=0;
+
+    A a;
+    return a;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]