<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91926>91926</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Incorrect execution result when an if clause is specified for a dependent task in a sibling task that has a task dependency
</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(1a498103ee5c4d101e70dc49db11938d8b87b518)/AArch64
```
In `sibling tasks` that have `task dependence`, when an `if` clause (the result is .false.) is specified for a `dependent task`, the execution result is incorrect.
The result is correct when line 27 of the program is changed as follows:
- Change `scalar-logical-expression` result specified in `if` clause from .false. to .true.
```
!$omp task shared(x) depend(in: x) if(x .ne. 0) ! if(.true.)
```
- Delete the `if` clause
```
!$omp task shared(x) depend(in: x) ! no if clause
```
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
taskdepend_054_2231.f90:
```fortran
module taskdepend_mod
integer, parameter :: ans=1
contains
subroutine init(x)
integer :: x
x = 2
end subroutine init
subroutine test(x)
integer :: x
if (x .ne. ans) then
print *, "NG"
else
print *, "OK"
end if
end subroutine test
end module taskdepend_mod
program main
use taskdepend_mod
integer :: x
call init(x)
!$omp parallel
!$omp single
!$omp task shared(x) depend(out: x)
x = x - 1
!$omp end task
!$omp task shared(x) depend(in: x) if(x .eq. 0) ! if(.false.)
call test(x)
!$omp end task
!$omp end single
!$omp end parallel
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp taskdepend_054_2231.f90; ./a.out
NG
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp taskdepend_054_2231.f90; ./a.out
OK
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 taskdepend_054_2231.f90; ./a.out
OK
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://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