<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86621>86621</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Execution error (Segmentation fault) when an allocatable array is used in task construct with a firstprivate clause in a parallel construct with a private clause
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 19.0.0(cbcdf126ccc774c063b5d5140c1393ff5305dded)/AArch64
```
When an `allocatable` array is used in `task` construct with a `firstprivate` clause in a `parallel` construct with a `private` clause, the execution terminates abnormally (Segmentation fault).
Execution terminates normally in the following cases:
- Array (a) is not an `allocatable` array, or
- Do not write `task` construct
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
omp3_task_firstprivate_013_232.f90:
```fortran
program main
integer(4),allocatable::a(:)
allocate(a(10))
a(9)=100
!$omp parallel private(a)
!$omp task firstprivate(a)
a(9)=10
!$omp end task
!$omp end parallel
write(6,*) "a(9) = ", a(9)
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp3_task_firstprivate_013_232.f90; ./a.out
Segmentation fault (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp3_task_firstprivate_013_232.f90; ./a.out
a(9) = 100
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 omp3_task_firstprivate_013_232.f90; ./a.out
a(9) = 100
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VVGPozYQ_jXOixVkxsDCAw_Z49K-bO_Uu7aPkTGG-Gowtc3l9t9XNpAlm72qUk-VoiS25xvPfPN5hlkru0GIEqWPKK12bHJnbUp9HvS-_bKrdfNcoowsH1IhcvhdGCv1gHWLW8WGbj-IC0b0gOMiIhFBkPOaN20MGef84SHhJ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