Parent component refers to the parent derived-type of an extended type.
The parent component is skipped when a specififc component is
referred to. This is fine since all the components in extended type
are available in the type itself. When the parent component is referred,
it need to be taken into account correctly.
This patch fixes the case when the parent component is referred. In a
box, an approriate slice is created or updated to point to the first
component of the parent component. For scalar, a simple conversion to
the parent component type is done.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
7779 | This code might also have to deal with rebox (if for instance y is an assumed shape array dummy argument in y(:)%p). | |
7791 | There is one killer case here: what if the parent type has no component ? module m type t1 end type type, extends(t1) :: t2 integer :: i end type interface subroutine bar(a) import :: t1 type(t1) :: a(:) end subroutine end interface contains subroutine foo(a) type(t2) :: a(10) call bar(a%t1) end subroutine end module It is probably fine to leave a TODO in that edge case for now. We may need to touch embox/rebox to deal with this case. | |
7801 | What if the original embox already had fields ? that can probably happen for: module m type t1 integer :: i end type type, extends(t1) :: t2 integer :: j end type type t integer :: k type(t2) :: c end type interface subroutine bar(a) import :: t1 type(t1) :: a(:) end subroutine end interface contains subroutine foo(a) type(t) :: a(10) call bar(a%c%t1) end subroutine end module |
- Handle rebox op
- Keep existing fields
- Add todo for parent component with no component
This code might also have to deal with rebox (if for instance y is an assumed shape array dummy argument in y(:)%p).