You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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 #131751
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:
program main
integer a(0:1)
a=0
!$omp parallel do reduction(+:a)
do i=1,10
a(0)=a(0)+1enddo
!$omp end parallel dowrite(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
$
program main
integer a(0:1)
a=0
!$omp parallel do reduction(+:a)
do i=1,10
a(1)=a(1)+1enddo
!$omp end parallel dowrite(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
$