Issue 239056
Summary [flang] IEEE_FMA and IEEE_GET_STATUS/IEEE_SET_STATUS have incorrect dummy argument names for keyword arguments
Labels flang
Assignees
Reporter dingcyrus
    Follow-up to #233449 / #233757 (which fixed `IEEE_IS_NAN` / `IEEE_IS_NEGATIVE` / `IEEE_IS_NORMAL`). Three more `IEEE_ARITHMETIC` procedures have dummy argument names that do not match the standard, so standard-conforming keyword references are rejected while non-standard keywords are accepted:

| Procedure (standard names) | flang currently uses | Where |
|---|---|---|
| `IEEE_FMA(X, Y, Z)` | `F1, F2, F3` | `__builtin_fma` entry in `flang/lib/Evaluate/intrinsics.cpp` |
| `IEEE_GET_STATUS(STATUS_VALUE)` | `STATUS` | `ieee_get_status_0` in `flang-rt/lib/runtime/__fortran_ieee_exceptions.f90` |
| `IEEE_SET_STATUS(STATUS_VALUE)` | `STATUS` | `ieee_set_status_0` in the same file |

**Reproducer**

```f90
program kw
  use ieee_arithmetic
 implicit none
  real :: a
  type(ieee_status_type) :: s
  a = ieee_fma(x=1.0, y=2.0, z=3.0)        ! expected: ok; actual: unknown keyword argument to intrinsic '__builtin_fma'
  call ieee_get_status(status_value=s) ! expected: ok; actual: no specific subroutine matches
  call ieee_set_status(status_value=s)     ! expected: ok; actual: keyword 'status_value=' not recognized
  print *, a
end program
```

The non-standard forms (`fma(f1=, f2=, f3=)`, `get/set_status(status=)`) are currently accepted.

Notes:
- `__builtin_fma` also backs the Fortran 2023 `FMA` intrinsic, whose dummy names are `X, Y, Z` as well, so renaming the table entry fixes both.
- Separately, `IEEE_SET_STATUS` appears to lack the optional `VALIDATE_FLAG` argument from the standard; that is a distinct gap and can be handled independently.

Happy to work on a PR following the same pattern as #233757 (fix + `flang/test/Semantics` keyword coverage).

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to