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

            Bug ID: 108209
           Summary: goof in genmatch.cc:commutative_op
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

It pretends that define_operator_list is commutative when its first member is
NOT commutative:

  if (user_id *uid = dyn_cast<user_id *> (id))
    {
      int res = commutative_op (uid->substitutes[0]);
      if (res < 0)
        return 0;
      for (unsigned i = 1; i < uid->substitutes.length (); ++i)
        if (res != commutative_op (uid->substitutes[i]))
          return -1;
      return res;
    }

The first 'return 0' should be 'return -1' instead.

Reply via email to