<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/143569>143569</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang] Unlimited pointer assignment within FORALL caused FIR verification failure
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:fir-hlfir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          DanielCChen
      </td>
    </tr>
</table>

<pre>
    Consider the following code:
```
module m
    type base
        integer*4 :: id = 0
    end type

    type, extends(base) :: child
        character*15 :: name = ''
    end type

    type (child), target, save :: c1_m(10)
end module

module m1
use m
    type baseContainer
        class (base), pointer :: data => null()
    end type

    type anyContainer
 class (*), pointer :: data => null()
        !character*1, pointer :: data => null()    ! workaround 1
    end type

end module

program fpAssgn025a
use m1
    type (anyContainer) :: co_a1(10)

    character*1, target :: ch1(10)

    class (child), target, allocatable :: c1(:)

 allocate (c1(10))

    forall (i=1:10)
    !do i = 1, 10 ! wordaround 2
        co_a1(i)%data => ch1(i)
    !end do
    end forall

end
```

Flang has
```
error: loc("t.f":38:9): 'fir.embox' op LEN parameters require CHARACTER or derived type
error: verification of lowering to FIR failed
```

If I apply either workaround marked in the code (1. don't use unlimited poly; 2. use do loop instead of forall), it compiles successfully. 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVV9vo7gX_TTm5aqRbSANDzwwSaNfpeq3UrX7PHLwBbxjbNY27eTbrwwkId1otFqE1EbY59zzByO8V61BLEn-jeSHRIyhs648CKNQ7_cdmuRk5bncW-OVRAehQ2is1vZTmRZqK5GkFaEV2dLlplVv5agRekIrAIBwHhBOwuPyO17KBGzREV5lEAHSCpQEkh6ALqvQyGlnxL7hEL4H_BnQSE_4bgLlxQWh7pSWK5K6E07UYaJh-WWVET1OTIQ_x_tXdED4bkblRaQOwrUY4n9efOCVl33vCd8xGlfRKkLNF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