This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ICE with -Wuninitialized (PR tree-optimization/78455)
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Aldy Hernandez <aldyh at redhat dot com>
- Date: Mon, 21 Nov 2016 16:02:40 -0800
- Subject: [PATCH] Fix ICE with -Wuninitialized (PR tree-optimization/78455)
- Authentication-results: sourceware.org; auth=none
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