The following fails the assert:
bool testf(float t) {
return cast(bool)t;
}
void test3918() {
assert(testf(float.nan));
}
int main() {
test3918();
return 0;
}
when compiling with -O for XMM. The generated code is:
xorps XMM1,XMM1
ucomiss XMM1,XMM0
jne LC
(*) jp LC
xor EAX,EAX
jmp short L11
LC: mov EAX,1
L11: ret
The (*) instruction is missing.
Comment #1 by dlang-bot — 2021-04-10T08:47:37Z
@WalterBright created dlang/dmd pull request #12416 "fix Issue 21816 - testing XMM for nan does not work" fixing this issue:
- fix Issue 21816 - testing XMM for nan does not work
https://github.com/dlang/dmd/pull/12416
Comment #2 by dlang-bot — 2021-04-11T00:02:10Z
dlang/dmd pull request #12416 "fix Issue 21816 - testing XMM for nan does not work" was merged into master:
- 7e8297e12e0528c775ab76cd57e3c6314e9ada7c by Walter Bright:
fix Issue 21816 - testing XMM for nan does not work
https://github.com/dlang/dmd/pull/12416