https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84251
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Testcase without headers: int cmp (double a, double b) { if (__builtin_isnan (a) || __builtin_isnan (b)) __builtin_abort (); return a == b; } In *.optimized we have: if (a_2(D) unord b_3(D)) goto <bb 3>; [0.04%] else goto <bb 4>; [99.96%] <bb 3> [0.04%] [count: 0]: __builtin_abort (); <bb 4> [99.96%] [count: INV]: _1 = a_2(D) == b_3(D); _4 = (int) _1; return _4; For int cmp (double a, double b) { return a == b; } we emit the same code as before though, but aren't able to figure out that we've already performed the unordered comparison before anymore.