<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64480>64480</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP]Variable used in TASK construct is not implicit firstprivate
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 17.0.0(359f170f5f712ee714193b46bad45a45656b2c59)
```
Variable used in `TASK` construct is not implicit `FIRSTPRIVATE`.
According to the following specification, the variable(a) in the test program is `FIRSTPRIVATE`.
- OpenMP Application Programming Interface Version 4.5 : subclause 2.15.1.1
The following are the test program, results of Flang-new, Gfortran and ifort compilation and execution.
omp3_task_024_2.f90:
```fortran
program main
!$omp parallel
call sub()
!$omp end parallel
print *,"pass"
end program main
subroutine sub
integer::a
a=5
!$omp task
write(6,*) "1 a = ", a
if (a.eq.5) then
a=a+10
else
print *,"NG-1:a=",a
end if
write(6,*) "2 a = ", a
!$omp end task
!$omp taskwait
write(6,*) "3 a = ", a
if (a.ne.5) then
print *,"NG-2:a=",a
end if
end subroutine sub
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp3_task_024_2.f90; ./a.out
1 a = 5
2 a = 15
3 a = 15
NG-2:a= 15
1 a = 5
2 a = 15
3 a = 15
NG-2:a= 15
pass
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp3_task_024_2.f90; ./a.out
1 a = 5
2 a = 15
3 a = 5
1 a = 5
2 a = 15
3 a = 5
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp omp3_task_024_2.f90; ./a.out
1 a = 5
2 a = 15
3 a = 5
1 a = 5
2 a = 15
3 a = 5
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vk1v2zgQ_TX0hbDAD1G2Dj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