Issue |
78936
|
Summary |
[Flang][OpenMP] Incorrect execution result of a do-variable in critical construct which exists in parallel construct with default(none) clause
|
Labels |
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang-new : 18.0.0(0fe86f9c518fb1296bba8d66ce495f9dfff2c435)
```
If `critical` construct exists in `parallel` construct with `default(none)` clause, a `do-variable` has an incorrect value after executing `parallel` construct.
A `do-variable` is `private` according to the specification in `Section (2.15.1.1) of OpenMP 4.5`, so the values of k1 and k2 are expected to be 1.
Changing `critical` construct to `sections` construct has the same result.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snfm_omp_array_do_011.f90:
```fortran
program main
integer::k1,k2
k1=1; k2=1
!$omp parallel default(none)
!$omp critical
do k2=1,10
do k1=1,10
end do
end do
!$omp end critical
!$omp endparallel
write(6,*) "k1 = ", k1, " k2 = ", k2
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp snfm_omp_shared_13_011.f90; ./a.out
k1 = 11 k2 = 11
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp snfm_omp_array_do_011.f90; ./a.out
k1 = 1 k2 = 1
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp snfm_omp_array_do_011.f90; ./a.out
k1 = 1 k2 = 1
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs