]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/106844 - fix ICE in init_use_preds
authorRichard Biener <rguenther@suse.de>
Tue, 6 Sep 2022 08:42:50 +0000 (10:42 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 6 Sep 2022 08:55:31 +0000 (10:55 +0200)
The following fixes an oversight in the last change to
compute_control_dep_chain where we have to return whether we found
a chain.

PR tree-optimization/106844
* gimple-predicate-analysis.cc (compute_control_dep_chain):
Return whether we found a chain.

* gcc.dg/pr106844.c: New testcase.

gcc/gimple-predicate-analysis.cc
gcc/testsuite/gcc.dg/pr106844.c [new file with mode: 0644]

index 681047deee77fc6fa12009c1328067f4606633b0..ef2906ebc51a8ced0fca14772949f420ec27e368 100644 (file)
@@ -1077,7 +1077,7 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb,
              if (dump_file)
                fprintf (dump_file, "param_uninit_control_dep_attempts "
                         "exceeded: %u\n", *num_calls);
-             return false;
+             break;
            }
          ++*num_calls;
 
diff --git a/gcc/testsuite/gcc.dg/pr106844.c b/gcc/testsuite/gcc.dg/pr106844.c
new file mode 100644 (file)
index 0000000..df68d76
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized --param uninit-control-dep-attempts=1" } */
+
+struct {
+  int count;
+  int array[8];
+} fde_merge_v1;
+
+void
+fde_merge_i2() {
+  unsigned i1;
+  do
+    while (i1 && fde_merge_v1.array[i1 - 1]) /* { dg-warning "uninitialized" } */
+      i1--;
+  while (fde_merge_i2);
+}