<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113375>113375</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Missing finalization call at intrinsic assignment.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
flang:runtime,
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following test case:
```
MODULE mDerivedModule
TYPE :: tTypeDerived(k1) ! (4)
INTEGER, KIND :: K1
INTEGER(4) :: i
INTEGER(4) :: j
CONTAINS
FINAL :: tTypeDerivedFinal
END TYPE tTypeDerived
CONTAINS
SUBROUTINE tTypeDerivedFinal( o )
TYPE(tTypeDerived(4)) :: o( :,:,: )
print*, "in final."
END SUBROUTINE tTypeDerivedFinal
END MODULE mDerivedModule
PROGRAM allocatedArrayDerived02
USE mDerivedModule
INTEGER(4) :: i
TYPE(tTypeDerived(4)) :: derivedArray( 2,2,2 ) =&
RESHAPE((/ (tTypeDerived(4)( i,(8 - i) ), i = 1, 8) /), (/ 2,2,2 /))
TYPE(tTypeDerived(4)), ALLOCATABLE :: derivedArrayAlloc( :,:,: )
ALLOCATE(derivedArrayAlloc( 3,3,3 ),&
SOURCE=RESHAPE((/ (tTypeDerived(4)( (27 - i),i ), i = 27, 1, -1) /),&
(/ 3,3,3 /)))
derivedArrayAlloc = derivedArray
END PROGRAM allocatedArrayDerived02
```
Expected behavior:
>a.out
in final
Actual behavior:
>a.out
It will work as expected if I
1. remove the KIND type parameter from the derived type definition, OR
2. remove the static initialization from the variables.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVUuT2jgQ_jXi0jWU3eZhDj54_MhSYSDF47BH2RagRNiUJDM7--u3JIvwTGZD2UK2vv5a_XVbTZXiu5qxiAxfyTDt0VbvGxmltOZMJMme1b2iqT6ipKkVr5gEvWewbYRo3nm9A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