| Issue |
203818
|
| Summary |
[flang] IEEE_IS_NAN sets IEEE_INVALID after inspecting a signaling NaN
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
ejose02
|
LLVM Flang leaves the IEEE_INVALID status flag set after IEEE_IS_NAN is applied to a real or double-precision value produced with IEEE_VALUE(..., IEEE_SIGNALING_NAN), even when halting on invalid is disabled and the flag was cleared immediately before the call. Fortran 2018 does not state that IEEE_IS_NAN may signal IEEE_INVALID for a signaling NaN (unlike IEEE_UNORDERED), so the flag should remain unset when the predicate is evaluated without other invalid operations.
Expected output:
The program should run to completion and print a single success line, with IEEE_GET_FLAG(IEEE_INVALID, …) remaining false after each IEEE_IS_NAN call.
Actual Output:
`FAIL real Ieee_Is_Nan raises INVALID`
Reproducer:
```Fortran
Program test
use Ieee_Arithmetic
Real r
Double Precision d
Logical invalid
If (Ieee_Support_Halting(Ieee_Invalid)) &
Call Ieee_Set_Halting_Mode(Ieee_Invalid,.False.)
r = Ieee_Value(r,Ieee_Signaling_Nan)
d = Ieee_Value(d,Ieee_Signaling_Nan)
Call Ieee_Set_Flag(Ieee_Invalid,.False.)
If (.Not.Ieee_Is_NaN(r)) Stop 'FAIL real Ieee_Is_Nan wrong value'
Call Ieee_Get_Flag(Ieee_Invalid,invalid)
If (invalid) Stop 'FAIL real Ieee_Is_Nan raises INVALID'
Call Ieee_Set_Flag(Ieee_Invalid,.False.)
If (.Not.Ieee_Is_NaN(d)) Stop 'FAIL double Ieee_Is_Nan wrong value'
Call Ieee_Get_Flag(Ieee_Invalid,invalid)
If (invalid) Stop 'FAIL double Ieee_Is_Nan raises INVALID'
Print '("Ok")'
End Program test
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs