<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88680>88680</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Compilation error when a variable specified in a threadprivate directive is used in parallel default(firstprivate) construct
</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(4f19f15a601a5761b12c9c66d99d97dbc89ef90d)/AArch64
```
A compilation error occurs when a variable specified in a `threadprivate` directive is used in `parallel default(firstprivate)` construct.
Compilation ends normally in the following cases:
- remove `default(firstprivate)` clause in `parallel` construct, or
- remove `threadprivate` directive
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snf_omp_default_003_241_252.f90:
```fortran
program main
integer,save::iii
!$omp threadprivate(iii)
!$omp parallel default(firstprivate)
iii=3
!$omp end parallel
end program main
```
```
$ flang-new -fopenmp snf_omp_default_003_241_252.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Pnavi35_01/snf_omp_default_003_241_252.f90":1:1): operand #0 does not dominate this use
error: verification of lowering to FIR failed
$
```
```
$ gfortran -fopenmp snf_omp_default_003_241_252.f90; ./a.out
$
```
```
$ ifort -qopenmp -diag-disable=10448 snf_omp_default_003_241_252.f90; ./a.out
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU2P2zYQ_TXjC2GDGn1YPPjg2FDRAkWDIujVoMWhxZQSVZLyNv--oOTdrL1pNy0K7NrgmJx5fHxvRoZgLgPRDsoPUB5Xcoqd8zvXDW6tP6_OTn3ZQcVvf_wIfP8b-WDcwJxm2srhsh7oiUG-Z5nY8A0HrAudCZ2VsuKZLLdVds6wFW1VKSGU2KpzWwvSgitAAdjs977tqmJJ_lBr-dyz1vWjsTKmuuS988y17eQDe-poY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