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

            Bug ID: 91090
           Summary: A suspicious code in tree-ssa-dom.c
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxue at os dot amperecomputing.com
  Target Milestone: ---

Find code snippet in simplify_stmt_for_jump_threading ():

      if (vr->kind () == VR_RANGE)
        {
          size_t i, j;

          find_case_label_range (switch_stmt, vr->min (), vr->max (), &i, &j);

          if (i == j)
            {
              tree label = gimple_switch_label (switch_stmt, i);
              tree singleton;

              if (CASE_HIGH (label) != NULL_TREE
                  ? (tree_int_cst_compare (CASE_LOW (label), vr->min ()) <= 0
                     && tree_int_cst_compare (CASE_HIGH (label), vr->max ()) >=
0)
                  : (vr->singleton_p (&singleton)
                     && tree_int_cst_equal (CASE_LOW (label), singleton)))
                return label;

              if (i > j)
                return gimple_switch_label (switch_stmt, 0);
            }
        }

The conditional "if (i > j)" should be outside of "if (i == j)"?

Reply via email to