https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117186
Bug ID: 117186 Summary: aarch64 wrong code for (a < b) < (b < a) Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kristerw at gcc dot gnu.org Target Milestone: --- The aarch64 compiler compiles the function int lx (int oi, int mb) { return (oi < mb) < (mb < oi); } to lx: cmp w0, w1 cset w0, hi ret with -O1 or higher optimization level. This is wrong. For example, lx(-1, 0) returns an incorrect result.