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

            Bug ID: 61686
           Summary: Incorrect check in comparison function
                    range_entry_cmp() in tree_ssa_reassoc.c
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maksqwe1 at ukr dot net

tree_ssa_reassoc.c 2021
range_entry_cmp()

...
if (p->high != NULL_TREE)        // <===
  {
     if (q->high != NULL_TREE)
  {
     tree tem = fold_binary (LT_EXPR, boolean_type_node,
                p->high, q->high);
     if (tem && integer_onep (tem))
            return -1;
     tem = fold_binary (GT_EXPR, boolean_type_node,
            p->high, q->high);
     if (tem && integer_onep (tem))
            return 1;
  }
     else
  return -1;
  }
else if (p->high != NULL_TREE) // <===
  return 1;

...

I think should be:
if (p->high != NULL_TREE)
...
else if (q->high != NULL_TREE)
  return 1;

Reply via email to