gcc/
PR middle-end/81564
* tree-cfg.c (group_case_labels_stmt): Handle already deleted blocks.
gcc/testsuite/
PR middle-end/81564
* gcc.dg/pr81564.c: New test.
From-SVN: r250628
+2017-07-27 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR middle-end/81564
+ * tree-cfg.c (group_case_labels_stmt): Handle already deleted blocks.
+
2017-07-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/81573
+2017-07-27 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR middle-end/81564
+ * gcc.dg/pr81564.c: New test.
+
2017-07-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/81573
--- /dev/null
+/* PR middle-end/81564 ICE in group_case_labels_stmt(). */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct a {
+ int b;
+ int c;
+};
+
+void
+foo (void)
+{
+ struct a *e;
+ switch (e->c)
+ {
+ case 7:
+ case 3:
+ if (__builtin_expect(!0, 0))
+ __builtin_unreachable();
+ }
+}
gcc_assert (base_case);
base_bb = label_to_block (CASE_LABEL (base_case));
- /* Discard cases that have the same destination as the default case. */
- if (base_bb == default_bb)
+ /* Discard cases that have the same destination as the default case or
+ whose destiniation blocks have already been removed as unreachable. */
+ if (base_bb == NULL || base_bb == default_bb)
{
i++;
continue;