I had a similar problem. In my case the behaviour of the isnan() was changed by the -ffast-math compiler flag. See clang.llvm.org/docs/UsersManual.html#cmdoption-ffast-math where it is stated :
This option lets the compiler make aggressive, potentially-lossy assumptions about floating-point math. These include:
...
Operands to floating-point operations are not equal to NaN and Inf, and