https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110666
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:d20e542ecd8cfc009b120f9e432caeb7005e7c53 commit r14-2554-gd20e542ecd8cfc009b120f9e432caeb7005e7c53 Author: Andrew Pinski <apin...@marvell.com> Date: Fri Jul 14 09:55:57 2023 -0700 Fix PR 110666: `(a != 2) == a` produces wrong code I had messed up the case where the outer operator is `==`. The check for the resulting should have been `==` and not `!=`. This patch fixes that and adds a full runtime testcase now for all cases to make sure it works. OK? Bootstrapped and tested on x86-64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/110666 * match.pd (A NEEQ (A NEEQ CST)): Fix Outer EQ case. gcc/testsuite/ChangeLog: PR tree-optimization/110666 * gcc.c-torture/execute/pr110666-1.c: New test.