[flang-commits] [PATCH] D139351: Lowering and runtime support for F08 transformational intrinsics: BESSEL_JN and BESSEL_YN

Tarun Prabhu via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Dec 9 08:36:50 PST 2022


tarunprabhu added inline comments.


================
Comment at: flang/runtime/transformational.cpp:168
+
+  if (n2 < n1) {
+    return;
----------------
vzakhari wrote:
> Should we also verify that `n1` and `n2` are non-negative?
The Fortran standard specifies that n1 and n2 should be non-negative. 

However, gfortran and ifort do not seem to check for this case. The output of this patch as currently implemented is comparable to the behavior of those two compilers when `x > 0.0`. The `x == 0.0` case is a bit messier.

A similar concern arose with one of the other intrinsics (https://reviews.llvm.org/D129316#3638582. See also @klausler's comment in the discourse post linked there). As before, I am happy to adhere more closely to the standard, or be more compatible with other compilers. For the latter case, I could do as @jeanPerier suggested in that patch and document our implementation more clearly. 

However, we do diverge from other compilers in the behavior of the intrinsics when compile-time constant negative values are passed. Both gfortran and ifort raise a compile-error in that case, while we do not. The runtime implementation is consistent with the current behavior when the parameters are compile-time constants.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139351/new/

https://reviews.llvm.org/D139351



More information about the flang-commits mailing list