[flang] Handle emboxing of a fir.ref<none> to an unlimited polymorphic box
authorValentin Clement <clementval@gmail.com>
Mon, 9 Jan 2023 16:52:14 +0000 (17:52 +0100)
committerValentin Clement <clementval@gmail.com>
Mon, 9 Jan 2023 16:52:44 +0000 (17:52 +0100)
commit747211b7126532eaa8f31b37fd4f6a0110e51358
tree1085a3b8f544100639c6d40e7c35608ad2f90a27
parent596a8d07d4ea61bf59e58ca8a768627949b08202
[flang] Handle emboxing of a fir.ref<none> to an unlimited polymorphic box

When an array element is extracted from an unlimited polymorphic array, the
emboxing of this element has to retrive the type code and element size from
the initial array. This patch retrive this information through the extracted
type descriptor.

This situation can be found in code like:

```
subroutine sub1(a)
  class(*) :: a(:)
  select type (x=>a(1))
  type is (integer)
    x = 10
  end select
end subroutine
```

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D141274
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/polymorphic.fir