https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106819
Bug ID: 106819 Summary: [13 Regression] NaN != NaN comparisons return false at -O2 since r13-2338 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- Isolated, and translated to C from the D testsuite, likely can be reduced further, as I don't think opCmpProper() affects the outcome. --- static int isNaN(double x) { return x != x; } static double opCmpProper(int lhs, double rhs) { return lhs < rhs ? -1.0 : lhs > rhs ? 1.0 : lhs == rhs ? 0.0 : __builtin_nan(""); } int main() { if (!isNaN(opCmpProper(41, __builtin_nan("")))) __builtin_abort(); return 0; }