This is an archive of the discontinued LLVM Phabricator instance.

[flang] Handle allocatable dummy arguments
ClosedPublic

Authored by clementval on Feb 24 2022, 6:59 AM.

Details

Summary

This patch handles allocatable dummy argument lowering
in function and subroutines.

This patch is part of the upstreaming effort from fir-dev branch.

Diff Detail

Event Timeline

clementval created this revision.Feb 24 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 6:59 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Feb 24 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 6:59 AM
schweitz accepted this revision.Feb 24 2022, 8:09 AM
This revision is now accepted and ready to land.Feb 24 2022, 8:09 AM
This revision was automatically updated to reflect the committed changes.
rogfer01 added inline comments.
flang/lib/Lower/CallInterface.cpp
658

I am curious about this. Does this mean that a type like

type foo
   integer :: x  
end type foo

is boxed (its number of parameters is empty) while

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?

Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2022, 5:42 AM
jeanPerier added inline comments.Apr 6 2022, 6:36 AM
flang/lib/Lower/CallInterface.cpp
658

I am curious about this. Does this mean that a type like

type foo
   integer :: x  
end type foo

is boxed (its number of parameters is empty) while

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.