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
Version of flang-new : 17.0.0(359f170f5f712ee714193b46bad45a45656b2c59)
Using the reduction-identifier(+) in the REDUCTION clause during a reduction(-) operation results in incorrect execution.
The result is correct when the test program is modified as follows:
Before the change
ia = ia-i
After the change
ia = ia+(-i)
z012.f90:
program main
integer*4 ia
integer*4:: loop=10
ia =0
!$omp parallel do reduction(+:ia)
do i=1, loop
ia = ia-i
end do
!$omp end parallel dowrite(*,*) " ia=",ia," It must be -55"
end
$ export OMP_NUM_THREADS=2; flang-new -fopenmp z012.f90; ./a.out
ia= 55 It must be -55
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp z012.f90; ./a.out
ia= -55 It must be -55
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp z012.f90; ./a.out
ia= -55 It must be -55
$