<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59924>59924</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
isless macro throws FE_INVALID when NAN is specified to the argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
utsumi-fj
</td>
</tr>
</table>
<pre>
The `isless` macro throws `FE_INVALID` when NAN is specified to the argument.
When one of the arguments of `isless` is unordered, `isless` should not throw "invalid" floating-point exception.
Reproducer:
test.c
```c
#include <stdio.h>
#include <math.h>
#include <fenv.h>
int main() {
long double nan128 = (long double)NAN;
if (isless(nan128, 1.0))
puts("test");
if (fetestexcept(FE_INVALID))
puts("FE_INVALID");
return 0;
}
```
Compilation commands and execution result:
```
$ clang --version
clang version 15.0.6 (https://github.com/llvm/llvm-project.git 088f33605d8a61ff519c580a71b1dd57d16a03f8)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work03/lang/llvm/llvm/15.0.6/bin
$ clang test.c -lm
$ ./a.out
FE_INVALID
$ clang test.c -lm -O1
$ ./a.out
$
```
This issue was detected in AArch64 machine.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF2L6zYQ_TXKyxAjjz_iPPghd3MNCyWFsrSPRbbGtu6VpaCPzfbfF8W73WTZLS0YG86ZOT46Gkl4ryZD1LLqG6uOGxHDbF0bg4-L2o4_Nr2Vf7VPMwGrufKavGc1h0UMzkKYnb34xHTf_3w8_X745fGY2MtMBk6HEygP_kyDGhVJCKmBQLgpLmRCxviR8cMfqdYaAjve0T4Bd_9UHqKxTpIjyfDhnvSzjVqCsWF1BQxRmWehlWSIMGorgjLT9myVCUAvA52DsubVxPr-jc7OyjiQY8XhlgjkQzbcIqzm6_OGYqHMoKMkYMWDD1LZbGbF98_YRYT5S3Ik83xLXt_J8iKUYdgw3APbfVtx0NZMIG3sNYERJscGWHEEhs0Nw3B_OpxY8dYEakwVr9lhszamRPOMM9ynZ608x-Cv_8SUAENM1JvOvdpIqWTNlWFzMw-fC94WfCrrKERngL8Tu-OH7G8bHuxyVlqkPYXBLosw0oMwEuiFhniFHfmow4et_SiGJQxamAm222dyXlmzEiv4CkFeZTyr07rnEM4-aWLHsJtUmGOfDXZh2Gn9_PbZnp39QUPIJhWAN81YFDWvZCPqfByrfD9UDRe7vM-lrHYyrwUvxuaf2J6EmygZByHcMNflNpqfxl7MVisTX7aTia-FsyMhYbGSdCo_W69eVurR-CC0JnlUabqBYXex7icvkkNhpnu_DLt1iQy7XpmP2aznAbZ6eWcyhp3IbAwrdLO_XzbD9tf8SwGG5b9s99OsPCjvI8FFeJAUaAgkQRk4HK4ZpStqVoayjWwLuS_2YkNtXu-KEmvE3WZux7Iqcb_r61LUZb_HppE8L8RYYT7UfVFtVIscC57nOW-KHd9lu5JKiSNWnGrqS2Ilp0UonaXMMuumzdVSW-33WG606En768WKaOiy-k3jXh03rr3ORR8nz0qulQ_-XSWooKldD-j9Vfse63-7ZDfR6fb_zSjD7mrUM-yuC_k7AAD__y0W0d8">