[flang-commits] [PATCH] D129616: Lower F08 bitwise-reduction intrinsics (IALL, IANY, IPARITY)

Peixin Qiao via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Sep 19 01:49:48 PDT 2022


peixin added inline comments.


================
Comment at: flang/lib/Lower/IntrinsicCall.cpp:811
+     {{{"array", asBox},
+       {"dim", asValue},
+       {"mask", asBox, handleDynamicOptional}}},
----------------
jeanPerier wrote:
> peixin wrote:
> > Should `dim` also be `handleDynamicOptional` to support the case `IALL (ARRAY [, MASK])`? Same for `iany`.
> No. Optional intrinsic arguments are tricky. There is a distinction between defining SOME_INTRINSIC signature being `SOME_INTRINSIC(ARG) and SOME_INTRINSIC()` vs `SOME_INTRINSIC([ARG])`.
> 
> In the first case, `ARG` is either **syntactically** present or absent in the source, and when it is syntactically present it is not an OPTIONAL argument: its actual argument cannot be an absent optional dummy, a disassociated pointer, nor an unallocated allocatable. The actual cannot be "dynamically" absent.
> 
> In the second case `[ARG]` is an OPTIONAL argument in the Fortran sense (the argument description in the standard states '(optional)', see MASK for instance. This is not the case for DIM). Its actual argument can be an actual argument cannot be an absent optional dummy, a disassociated pointer, or an unallocated allocatable. `handleDynamicOptional` is meant to deal with these cases, so it would add a pointless overhead to use it for DIM here.
Got it. Thanks.


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

https://reviews.llvm.org/D129616



More information about the flang-commits mailing list