The following obvious fix fixes the ICE in PR56501.

Boostrap / regtest pending on x86_64-unknown-linux-gnu.

Richard.

2013-04-03  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/56501
        * tree-switch-conversion.c (check_process_case): Properly
        handle !single_succ_p case.

        * gcc.dg/torture/pr56501.c: New testcase.

Index: gcc/tree-switch-conversion.c
===================================================================
--- gcc/tree-switch-conversion.c        (revision 197348)
+++ gcc/tree-switch-conversion.c        (working copy)
@@ -283,7 +283,12 @@ check_process_case (tree cs)
          return false;
        }
 
-      e = single_succ_edge (label_bb);
+      if (!single_succ_p (label_bb))
+       {
+         info.reason
+           = "  Bad case - a non-final BB without a single successor\n";
+         return false;
+       }
       following_bb = single_succ (label_bb);
     }
 
Index: gcc/testsuite/gcc.dg/torture/pr56501.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr56501.c      (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr56501.c      (working copy)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+int a;
+void try_help () __attribute__ ((__noreturn__));
+void try_help ()
+{
+}
+
+int main ()
+{
+  switch (a)
+    {
+      case '1':
+      case '2':
+      case '3':
+      case '4':
+      case '5':
+      case '6':
+      case '7':
+      case '8':
+      case '9':
+         break;
+      default:
+         try_help ();
+    }
+}

Reply via email to