[flang] -fhonor-infinities doesn't honor them for -inf**0.5
Open
flang
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Consider the following program:
```fortran
program test_pow_neginf
use, intrinsic :: ieee_arithmetic
real :: neg_inf, result
neg_inf = ieee_value(neg_inf, ieee_negative_inf)
result = neg_inf ** 0.5
print *, "(-inf) ** 0.5 = ", result
end program test_pow_neginf
```
Compilation and run:
```bash
$ flang t.f90 -O2 -fno-fast-math -fhonor-infinities && ./a.out
(-inf) ** 0.5 = NaN
```
It prints `NaN`. I would expect `inf` (as in C). `gfortran` returns `NaN` or `inf` depending on whether `-ffast-math` is used.
Compiler explorer link: https://fortran.godbolt.org/z/zeEzqGbxf
Contributor guide
Assessment
This issue has not been assessed yet.