https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105770
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:0d5cc976a36af07c9790c38a99a0b98110c89795 commit r13-912-g0d5cc976a36af07c9790c38a99a0b98110c89795 Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Jun 1 14:00:49 2022 +0200 unswitch: Fold case label lo/hi values to index type [PR105770] The following testcase ICEs because we use different types in comparison, idx has int type, while CASE_LOW has char type. While I believe all CASE_{LOW,HIGH} in the same switch have to use the same or compatible type, the index expression can have a promoted type as happens in this testcase. Other spots that handle switches do such foldings too. 2022-06-01 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/105770 * tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb): Cast CASE_LOW and CASE_HIGH to TREE_TYPE (idx) before comparisons with idx. * gcc.dg/pr105770.c: New test.