https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116120
Bug ID: 116120 Summary: Wrong code for (a ? x : y) != (b ? x : y) Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: kristerw at gcc dot gnu.org Target Milestone: --- GCC is miscompiling the functions in g++.dg/tree-ssa/pr111150.C, such as: typedef int v4si __attribute((__vector_size__(4 * sizeof(int)))); v4si f1_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) { v4si X = a == b ? e : f; v4si Y = c == d ? e : f; return (X != Y); } The reason is that PR111150 implemented match patterns of the form: (a ? x : y) != (b ? x : y) --> (a^b) ? TRUE : FALSE But this optimization is not correct -- the optimized code gives us a different result for: a = TRUE b = FALSE x = 0 y = 0