[flang-commits] [flang] [flang][hlfir] patch for assumed shape dummy with VALUE keyword (PR #70391)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 27 03:03:25 PDT 2023
================
@@ -977,10 +977,14 @@ class Fortran::lower::CallInterfaceImpl {
addPassedArg(PassEntityBy::MutableBox, entity, characteristics);
} else if (dummyRequiresBox(obj, isBindC)) {
// Pass as fir.box or fir.class
- if (isValueAttr)
- TODO(loc, "assumed shape dummy argument with VALUE attribute");
- addFirOperand(boxType, nextPassedArgPosition(), Property::Box, attrs);
- addPassedArg(PassEntityBy::Box, entity, characteristics);
+ Property prop = Property::Box;
+ PassEntityBy passBy = PassEntityBy::Box;
+ if (isValueAttr) {
+ passBy = PassEntityBy::BaseAddressValueAttribute;
+ prop = Property::Value;
+ }
----------------
jeanPerier wrote:
PassEntityBy::BaseAddressValueAttribute and Property::Value are incorrect here (they first implies the argument should be prepared as a raw address for a VALUE, and the second says that the FIR argument at that position is a value in register).
This makes no difference on the callee side, but if you add tests that calls procedure with such arguments, there will likely be issues since BaseAddressValueAttribute implies the base address should be passed.
I think you will want to just keep it as it is, the VALUE attribute is checked in HLFIR here https://github.com/llvm/llvm-project/blob/e4dc7d492c7bf65b281f178c0c00ad423a3a4c5c/flang/lib/Lower/ConvertCall.cpp#L917.
Without HLFIR, there is a need for a new BoxValueAttribute category and special handling for it (that is why I think the TODO should only be lifted when lowering to HLFIR `converter.getLoweringOptions().getLowerToHighLevelFIR()`).
https://github.com/llvm/llvm-project/pull/70391
More information about the flang-commits
mailing list