Issue |
91926
|
Summary |
[Flang][OpenMP] Incorrect execution result when an if clause is specified for a dependent task in a sibling task that has a task dependency
|
Labels |
openmp,
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
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
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs