<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114889>114889</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Execution error when derived type is specified in lastprivate clause of sections construct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 20.0.0(5621929f7f4878c318deecb592cd03f5ecbb83ba)/AArch64
```
When `derived type` is specified in `lastprivate` clause of `sections` construct, segmentation fault (core dumped) occurs.
The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.
FT_OMP_LastPrivate_009_2232.f90:
```fortran
program main
type x
integer::x2
character(len=5)::c1
integer,allocatable::x1(:,:)
end type x
type(x) :: v(2)
allocate(v(1)%x1(2,2))
v(1)%x1 = 11
!$omp parallel
!$omp sections lastprivate(v)
if (any(v(1)%x1/=11)) print *,1201,v(1)%x1
deallocate(v(1)%x1)
allocate(v(1)%x1(4,6))
v(1)%x1 = 21
!$omp end sections
!$omp end parallel
print *,'PASS'
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
Segmentation fault (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
1201 0 0 0 0
PASS
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
1201 0 0 0 0
PASS
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vl9zozYQ_zTyy449sAIMD35w7HP70PQyTdp7zAhYsG5kRCWRON--I4EdO7n2MtM7JkMk7Wr__Njdn4W1su2IViy9Yel2Jga312al952eN19npa5fVi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