Issue |
141438
|
Summary |
[Flang][OpenMP] Variable in parallel sections construct with default(private) clause is not treated as private
|
Labels |
flang:openmp
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(fb86b3d96b73f4e628288b180ef4e038da8b7bc1)/AArch64
```
sngf_reduction71_222.f90:
```fortran
program main
integer a
a=10
!$omp parallel sections default(private)
a=15
!$omp end parallel sections
print *,'a = ', a
end program main
```
`Variable (a)` in `parallel sections construct` with `default (private) clause` is not treated as `private`.
After `parallel sections construct` ends, the value of `variable (a)` is expected to be 10.
I found `variable (a)` is treated as `private` in the following cases:
- `default (private) clause` is changed to `private (a) clause`
See sngf_reduction71_232.f90 below.
- `parallel sections construct` is changed to `parallel construct`
See sngf_reduction71_223.f90 below.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngf_reduction71_222.f90; ./a.out
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
a = 15
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngf_reduction71_222.f90; ./a.out
a = 10
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngf_reduction71_222.f90; ./a.out
a = 10
$
```
sngf_reduction71_232.f90:
```fortran
program main
integer a
a=10
!$omp parallel sections private(a)
a=15
!$omp end parallel sections
print *,'a = ', a
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngf_reduction71_232.f90; ./a.out
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
a = 10
$
```
sngf_reduction71_223.f90:
```fortran
program main
integer a
a=10
!$omp parallel default(private)
a=15
!$omp end parallel
print *,'a = ', a
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngf_reduction71_223.f90; ./a.out
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
a = 10
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs