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.
Keeping notes as I go... Duplicated checks for 'op0' in lower_for are duplicated.
Mine.
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:46034c46f82dec169fe7fc7c2d82d8321d9a9512 commit r13-5068-g46034c46f82dec169fe7fc7c2d82d8321d9a9512 Author: Richard Biener <rguenther@suse.de> Date: Mon Jan 9 14:28:03 2023 +0100 middle-end/108209 - typo in genmatch.cc:commutative_op The early out for user-id handling indicated commutative rather than not commutative. PR middle-end/108209 * genmatch.cc (commutative_op): Fix return value for user-id with non-commutative first replacement.
Fixed.