https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117612
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2024-11-15 CC| |jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This boils down to char foo (double a, double b) { if (a != b) return a < b; return 0; } which is what it is optimized into shortly after inling. With -ffast-math this is optimized into return a < b, but without it we don't because a < b comparison can raise exceptions while a != b doesn't. Of course in this particular case it doesn't matter, because a < b isn't done only if a == b and in that case neither operand should be NaN and so a < b shouldn't raise exceptions.