[PATCH] D118776: [flang] Add runtime interface for GET_COMMAND

Jean Perier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 02:07:47 PST 2022


jeanPerier added inline comments.


================
Comment at: flang/include/flang/Runtime/command.h:31
+std::int32_t RTNAME(GetCommand)(const Descriptor *command = nullptr,
+    std::int64_t *length = nullptr, const Descriptor *errmsg = nullptr);
+
----------------
Passing `length` as a simple pointer is tempting, but I think it will be problematic because the actual Fortran entity for the length is not guaranteed to be a INTEGER(8). It is only required that it  must have a decimal exponent range of at least four.

So if we blindly cast and pass the length in lowering, we may have troubles. And dealing with maybe allocating an INTEGER(8) temp is not easier than the previous interface.

So, I think this either has to be a `const Descriptor *length`, or lowering has to get more clever and be able to deal with dynamically optional argument with your previous interface.

I tend to think `const Descriptor *length` is the easiest solution, and since this is not a computational intrinsic, I am not sure the descriptor overhead is a big deal.

@klausler , do you agree ?


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

https://reviews.llvm.org/D118776



More information about the llvm-commits mailing list