Hi,

bootstrapped and regtested on x86_64 linux.  Ok to push?

Filip Kastl


-- 8< ---


I have mistakenly assumed that switch lowering cannot encounter a switch
with zero clusters.  This patch removes the relevant assert and instead
gives up bit-test lowering when this happens.

        PR tree-optimization/120080

gcc/ChangeLog:

        * tree-switch-conversion.cc (bit_test_cluster::find_bit_tests):
        Replace assert with return.

Signed-off-by: Filip Kastl <fka...@suse.cz>
---
 gcc/tree-switch-conversion.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index dea217a01ef..bd4de966892 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -1793,12 +1793,14 @@ bit_test_cluster::find_bit_tests (vec<cluster *> 
&clusters, int max_c)
      end up with as few clusters as possible.  */
 
   unsigned l = clusters.length ();
-  auto_vec<min_cluster_item> min;
-  min.reserve (l + 1);
 
-  gcc_checking_assert (l > 0);
+  if (l == 0)
+    return clusters.copy ();
   gcc_checking_assert (l <= INT_MAX);
 
+  auto_vec<min_cluster_item> min;
+  min.reserve (l + 1);
+
   int bits_in_word = GET_MODE_BITSIZE (word_mode);
 
   /* First phase: Compute the minimum number of clusters for each prefix of the
-- 
2.49.0

Reply via email to