[flang-commits] [flang] [flang] Fix: Reject OPTIONAL dummy arguments for DIM in ALL/ANY/COUNT (PR #171971)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Dec 12 12:19:31 PST 2025
klausler wrote:
The prohibition against an `OPTIONAL` dummy argument being used for a `DIM=` actual argument is not present in Fortran 2023 for `ALL` or `ANY`.
There's no good reason for this usage to be a hard error -- the program will work fine so long as an `OPTIONAL` dummy argument in this context is actually present, and every other surviving production Fortran compiler allows it (hence the portability warning). I suspect that the prohibition for `COUNT()` in the standard is just meant to imply that `COUNT(..., DIM=dummyarg)` isn't meant to mean the same as `COUNT(...)` when `dummyarg` is absent, since that would make the rank of the result unknowable at compilation time.
https://github.com/llvm/llvm-project/pull/171971
More information about the flang-commits
mailing list