<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126806>126806</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnostic on deallocating unlimited polymorphic pointer component
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</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
class (*), pointer :: data => null() !! Error
!real, pointer :: data => null() !! Pass
contains
final :: finalizeBase
end type
contains
elemental subroutine finalizeBase (b)
type (base), intent(inout) :: b
if (associated(b%data)) deallocate (b%data)
end subroutine
end module
```
Flang is currently issue an error as
```
error: Semantic errors in t3.f
./t3.f:15:45: error: Object in DEALLOCATE statement is not deallocatable
if (associated(b%data)) deallocate (b%data)
^^^^
./t3.f:15:45: because: 'data' is polymorphic in a pure subprogram
if (associated(b%data)) deallocate (b%data)
^^^^
./t3.f:3:31: Declaration of 'data'
class (*), pointer :: data => null()
^^^^
```
The compilation is successful if the pointer component is intrinsic type.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VNuK5DYQ_Rr5pdhGlu1x-8EP3r5AYGED2R-QpXK3giwZXTZMvj6U27PtmSQQEtK4L1Krjk6dqlMyRnNziD1rPrPmXMic7j70Z-kM2tPpjq4YvX7tT95FozFAuiNM3lr_m3E3UF4jqwbGB_bCt4cPs9fZIsyMDwAA6XVBGGXEbU0vZWWMwMSRiYGJjokTLN64hAEIrxpAyySBVWdWXcBla9ez3Vs8MFEyUcIlBB92uEyUAaX953gbzs8yRspix9C7JI2Lu63JOGnf8NaF-R0_b4mh02umT5QdwraDFmd0SVqIeQw-J-PwHRApMpIefHjIRmu64CERJeQSE0fjfE4r_QeZcc_dTBQmY_TKyIT6gdmQACtOBxqltV7J9Hbhjz83nk7vGDI-0Majqh9KzfhwtdLdwERQOQR0yb6CiTEjSAdI5QEZP0St28T7F5ylS0Y9DkYwDlJ1mBgfDkxc15_VUDasGmr6gB-BX8dfUSU6f74MX758PQ3fLhCTTKvAxMb59MxTjnbfff9RIdZcns_fUR1RyRzJHcBE-4huidji7evsw3I3ivhLWHJAknsJ_hbk6pr_jWBF75JInVFZGWQy3oGfdhx3Ov17n_4Fiw9t8-2OoPy8GPvgYCLErBTGOGVLAtCkebuLDnq3Vda4FIyLRq0WORS6r3RXdbLAvmyrripLUbbFva9b0datrKUSnT5207FWTds1Tc01P06jKkwvuGi4KEshOC_bQymqWileKzUJPeqO1RxnaezB2u_zwYdbsXZ2X4qXI38prBzRxnV0CjGRDVg1TMGTSzUTggZq6Cn205hvkdXcmpjiEy2ZZNfRu3qINWf4ySkfArW2NvLmfCRzePcsN03d7KyZTUL9rpf-pFWRg-3vKS2RSiWuTFxvJt3zeFB-ZuJKNLavT0vwZCgmrmuGkYnrluT3XvwRAAD__8EZ1ws">