https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96818
Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at redhat dot com, | |law at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Depends on| |87798 --- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- [Could other gimple experts pontificate here?] This is caused by the problem reported in PR87798. We have a switch_stmt with a control variable of type int: int _6; ... _6 = _5 & 255; switch (_6) <default: <L7> [33.33%], case 0: <L3> [33.33%], case 1: <L6> [33.33%]> But the cases are unsigned char: (gdb) p debug_tree(case_high) <integer_cst 0x7fffea8bd870 type <integer_type 0x7fffea76e348 unsigned char> constant 1> This is causing us to intersect incompatible ranges: (gdb) p debug (range_of_op) int [0, 255] $21 = void (gdb) p debug (label_range) unsigned char [0, 1] $22 = void (gdb) Are incompatible switch operands and labels valid gimple? I would say no. This look like a latent bug. FWIW, the reason this was working before was because the original code used tree_int_cst_compare which upgrades everything to a widest_int before doing the comparison: inline int tree_int_cst_compare (const_tree t1, const_tree t2) { return wi::cmps (wi::to_widest (t1), wi::to_widest (t2)); } I could hack around it, but would rather we fix the underlying problem. Is this valid gimple or not? Thanks. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87798 [Bug 87798] EH lowering is creating a gimple_switch statement with type-incompatible index and case labels