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 ICE with -Wuninitialized (PR tree-optimization/78455)


What seems like a typo caused an ICE here.  We've got a vector of vectors here
and we're trying to walk all the elements, so the second loop oughta use 'j'.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2016-11-21  Marek Polacek  <polacek@redhat.com>

	PR tree-optimization/78455
	* tree-ssa-uninit.c (can_chain_union_be_invalidated_p): Fix typo.

	* gcc.dg/uninit-23.c: New.

diff --git gcc/testsuite/gcc.dg/uninit-23.c gcc/testsuite/gcc.dg/uninit-23.c
index e69de29..b38e1d0 100644
--- gcc/testsuite/gcc.dg/uninit-23.c
+++ gcc/testsuite/gcc.dg/uninit-23.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/78455 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+int ij;
+
+void
+ql (void)
+{
+  int m5 = 0;
+
+  for (;;)
+  {
+    if (0)
+      for (;;)
+      {
+        int *go;
+        int *t4 = go;
+
+ l1:
+        *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "may be used uninitialized" } */
+      }
+
+    if (ij != 0)
+      goto l1;
+  }
+}
diff --git gcc/tree-ssa-uninit.c gcc/tree-ssa-uninit.c
index 68dcf15..4557403 100644
--- gcc/tree-ssa-uninit.c
+++ gcc/tree-ssa-uninit.c
@@ -2192,7 +2192,7 @@ can_chain_union_be_invalidated_p (pred_chain_union use_preds,
       pred_chain c = use_preds[i];
       bool entire_pred_chain_invalidated = false;
       for (size_t j = 0; j < c.length (); ++j)
-	if (can_one_predicate_be_invalidated_p (c[i], worklist))
+	if (can_one_predicate_be_invalidated_p (c[j], worklist))
 	  {
 	    entire_pred_chain_invalidated = true;
 	    break;

	Marek


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