trippels@gcc2-power8 linux % cat book3s_pr_papr.i int a, c; int b[1]; int fn1() { switch (a) case 0: case 2: return 1; return 0; } void fn2() { int i; for (;; ++i) { c = b[i]; int d = !fn1(); if (d) __asm__(""); } } trippels@gcc2-power8 linux % gcc -c -O3 book3s_pr_papr.i book3s_pr_papr.i: In function ‘fn2’: book3s_pr_papr.i:10:6: error: missing edge 2->4 void fn2() { ^~~ book3s_pr_papr.i:10:6: internal compiler error: verify_flow_info failed 0x10359553 verify_flow_info() ../../gcc/gcc/cfghooks.c:260 0x1094081b checking_verify_flow_info ../../gcc/gcc/cfghooks.h:198 0x1094081b cleanup_tree_cfg_noloop ../../gcc/gcc/tree-cfgcleanup.c:837 0x1094081b cleanup_tree_cfg() ../../gcc/gcc/tree-cfgcleanup.c:883 0x107bbfc7 execute_function_todo ../../gcc/gcc/passes.c:1922 0x107bcd53 do_per_function ../../gcc/gcc/passes.c:1653 0x107bcfd3 execute_todo ../../gcc/gcc/passes.c:2023
Started with r248155.
Sigh, mine.
Testing a patch.
Stupid thinko on my part. An extra increment is causing us to skip some of the case labels in the switch statement, which only causes an ICE/problem if the skipped case happens to point to the same unreachable block as an earlier case label. In that case, the earlier case has already removed the unreachable block, but skipped case label still points to it, leading to the verify_flow ICE. I'm testing the following: Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 248375) +++ gcc/tree-cfg.c (working copy) @@ -1726,7 +1726,6 @@ group_case_labels_stmt (gswitch *stmt) remove_edge_and_dominated_blocks (base_edge); gimple_switch_set_label (stmt, base_index, NULL_TREE); new_size--; - i++; } }
Author: bergner Date: Wed May 24 12:10:54 2017 New Revision: 248408 URL: https://gcc.gnu.org/viewcvs?rev=248408&root=gcc&view=rev Log: gcc/ PR middle-end/80823 * tree-cfg.c (group_case_labels_stmt): Delete increment of "i"; gcc/testsuite/ PR middle-end/80823 * gcc.dg/pr80823.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr80823.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-cfg.c
Fixed in revision r248408.
Closing as fixed.