Issue 166602
Summary [flang] -fhonor-infinities doesn't honor them for -inf**0.5
Labels flang
Assignees
Reporter nurmukhametov
    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
$ 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. Is this a bug?

Compiler explorer link: https://fortran.godbolt.org/z/zeEzqGbxf
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to