Issue |
131751
|
Summary |
[Flang][OpenMP] Incorrect execution result when reduction-identifier of reduction clause is specified as + and an array with a subscript of 0 is used in the reduction operation
|
Labels |
flang:openmp
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(3e6f618e86f5fbad2c2d5802416ec3d3366a2837)/AArch64
```
In `parallel do reduction` directive, when `reduction-identifier` of `reduction` clause is specified as `+` and an array with a subscript of 0 is used for the `reduction` operation, the result is incorrect.
The result of the reduction operation does not appear to be assigned.
The above program is `test132.f90`.
When an array with a subscript of 1 is used in the `reduction` operation, the result is correct.
The above program is `test131.f90`.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
test132.f90:
```fortran
program main
integer a(0:1)
a=0
!$omp parallel do reduction(+:a)
do i=1,10
a(0)=a(0)+1
enddo
!$omp end parallel do
write(6,*) "a(0) = ", a(0)
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp test132.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
a(0) = 0
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp test132.f90; ./a.out
a(0) = 10
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp test132.f90; ./a.out
a(0) = 10
$
```
test131.f90:
```fortran
program main
integer a(0:1)
a=0
!$omp parallel do reduction(+:a)
do i=1,10
a(1)=a(1)+1
enddo
!$omp end parallel do
write(6,*) "a(1) = ", a(1)
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp test131.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
a(1) = 10
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp test131.f90; ./a.out
a(1) = 10
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp test131.f90; ./a.out
a(1) = 10
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs