[PATCH] D120483: [flang] Handle allocatable dummy arguments
Jean Perier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 06:36:07 PDT 2022
jeanPerier added inline comments.
================
Comment at: flang/lib/Lower/CallInterface.cpp:658
+ // Need to pass type parameters in fir.box if any.
+ return derived->parameters().empty();
+ return false;
----------------
rogfer01 wrote:
> I am curious about this. Does this mean that a type like
>
> ```lang=fortran
> type foo
> integer :: x
> end type foo
> ```
>
> is boxed (its number of parameters is empty) while
>
>
> ```lang=fortran
> type foo2(l)
> integer, len :: l
> integer :: x
> end type foo2
> ```
>
> is not boxed (its number of parameters is not empty).
>
> Maybe the intent of the code is the opposite?
> I am curious about this. Does this mean that a type like
>
> ```lang=fortran
> type foo
> integer :: x
> end type foo
> ```
>
> is boxed (its number of parameters is empty) while
>
>
> ```lang=fortran
> type foo2(l)
> integer, len :: l
> integer :: x
> end type foo2
> ```
>
> is not boxed (its number of parameters is not empty).
>
> Maybe the intent of the code is the opposite?
Absolutely, thanks for catching this. This was not very exposed because this code is only visited when `dummy.CanBePassedViaImplicitInterface()` is false, but it means flang is currently using descriptors to pass explicit shape non parametrized derived type dummies with the OPTIONAL attribute , or TARGET attribute (or other attributes that require an explicit interface), and that is a waste of time.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120483/new/
https://reviews.llvm.org/D120483
More information about the llvm-commits
mailing list