| Issue |
114890
|
| Summary |
[Flang][OpenMP] Incorrect execution result when multiple associate and parallel private constructs are nested
|
| Labels |
flang:openmp
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang-new : 20.0.0(5621929f7f4878c318deecb592cd03f5ecbb83ba)/AArch64
```
When multiple `associate` and `parallel private` constructs are nested, the value of `association` is incorrect.
The above program is `FT_openmp_private_09_21.f90`
When `associate` construct is not nested, the result is correct.
The above program is `FT_openmp_private_09_22.f90`
The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.
FT_openmp_private_09_21.f90:
```fortran
program main
integer :: b(3)=5
integer :: d=10
real :: f=15
associate(c=>d, a=>b(2:3))
!$omp parallel private(b,d,f)
associate(e=>f)
!$omp parallel private(f)
b=7
d=8
f=9
if(e .ne. 15) print*,"104",e
!$omp end parallel
end associate
if(a(1) .ne. 5) print*,"101"
if(a(2) .ne. 5) print*,"102"
if(c .ne. 10) print*,"103",c
!$omp end parallel
print*, "pass"
end associate
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp FT_openmp_private_09_21.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
104 1.54E-43
104 6.3116734E-19
pass
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp FT_openmp_private_09_21.f90; ./a.out
104 2.25024438
104 0.00000000
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp FT_openmp_private_09_21.f90; ./a.out
pass
$
```
FT_openmp_private_09_22.f90:
```fortran
program main
integer :: b(3)=5
integer :: d=10
real :: f=15
associate(c=>d, a=>b(2:3),e=>f)
!$omp parallel private(b,d,f)
! associate(e=>f)
!$omp parallel private(f)
b=7
d=8
f=9
if(e .ne. 15) print*,"104",e
!$omp end parallel
! end associate
if(a(1) .ne. 5) print*,"101"
if(a(2) .ne. 5) print*,"102"
if(c .ne. 10) print*,"103",c
!$omp end parallel
print*, "pass"
end associate
end program main
```
```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp FT_openmp_private_09_22.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
pass
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp FT_openmp_private_09_22.f90; ./a.out
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp FT_openmp_private_09_22.f90; ./a.out
pass
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs