| Issue |
74273
|
| Summary |
[Flang][OpenMP] Incorrect execution result of using statement function in task construct
|
| Labels |
openmp,
flang:frontend
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang-new : 18.0.0(770dc47659d41a5ca7b7daf5b3134c900ca8c33d)
```
When `statement function` is used within `task` construct, such as in an attached program, the value of the variable (iaa) used in `statement function` does not look like `firstprivate` after `task` construct ends.
If a function is used directly instead of `statement function`, the value of the variable is correct.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
:
```fortran
program main
integer prv
if(i)=ifun(iaa)
prv=1; iaa=1; ii=1
!$omp parallel shared(prv)
!$omp task default(firstprivate)
prv = prv + 1
ii=if(ii)
! ii=ifun(iaa) ! OK if not statement function
!$omp end task
write(6,*) "prv = ", prv, " iaa = ", iaa
if (iaa.ne.1) write(6,*) "NG : iaa = ", iaa
!$omp end parallel
end program main
function ifun(j)
j=100; ifun=1
end function ifun
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp snf_emski_omp_01_2.f90; ./a.out
prv = 1 iaa = 1
prv = 1 iaa = 100
NG : iaa = 100
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp snf_emski_omp_01_2.f90; ./a.out
prv = 1 iaa = 1
prv = 1 iaa = 1
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp snf_emski_omp_01_2.f90; ./a.out
prv = 1 iaa = 1
prv = 1 iaa = 1
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs