https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105770

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |decompose, at               |decompose, at
                   |wide-int.h:984              |wide-int.h:984 since
                   |                            |r13-754
           Priority|P3                          |P1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r13-754-ga1c9f779f75283427316b5c670c1e01ff8ce9ced
--- gcc/tree-ssa-loop-unswitch.cc.jj    2022-05-25 11:07:29.754185772 +0200
+++ gcc/tree-ssa-loop-unswitch.cc       2022-05-30 10:57:23.165131441 +0200
@@ -494,6 +494,7 @@ find_unswitching_predicates_for_bb (basi
     {
       unsigned nlabels = gimple_switch_num_labels (stmt);
       tree idx = gimple_switch_index (stmt);
+      tree idx_type = TREE_TYPE (idx);
       if (TREE_CODE (idx) != SSA_NAME
          || nlabels < 1)
        return;
@@ -526,16 +527,18 @@ find_unswitching_predicates_for_bb (basi
          if (CASE_HIGH (lab) != NULL_TREE)
            {
              tree cmp1 = fold_build2 (GE_EXPR, boolean_type_node, idx,
-                                      CASE_LOW (lab));
+                                      fold_convert (idx_type,
+                                                    CASE_LOW (lab)));
              tree cmp2 = fold_build2 (LE_EXPR, boolean_type_node, idx,
-                                      CASE_HIGH (lab));
+                                      fold_convert (idx_type,
+                                                    CASE_HIGH (lab)));
              cmp = fold_build2 (BIT_AND_EXPR, boolean_type_node, cmp1, cmp2);
              lab_range.set (CASE_LOW (lab), CASE_HIGH (lab));
            }
          else
            {
              cmp = fold_build2 (EQ_EXPR, boolean_type_node, idx,
-                                CASE_LOW (lab));
+                                fold_convert (idx_type, CASE_LOW (lab)));
              lab_range.set (CASE_LOW (lab));
            }

fixes it for me.

Reply via email to