Issue 71370
Summary [Flang][OpenMP]Incorrect execution result when reduction-identifier(+) is used in REDUCTION clause
Labels flang:frontend, flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 18.0.0(1c876ff5155c4feeb2b2885eb3e6abda17c4b7f4)
```

Using `reduction-identifier(+)` in `REDUCTION` clause results in incorrect execution.  
The program is executed on 1 thread and expects a value of 11 for a.

The following are the test program, Flang-new, Gfortran and ifort compilation result.

ompds111_2.f90:
```fortran
program main
  integer :: a
  call OMP_SET_NUM_THREADS(1)
  a=1
!$omp parallel reduction(+:a)
  a=10
!$omp end parallel
  print *,a
end program main
```

```
$ flang-new ompds111_2.f90 -fopenmp; ./a.out
 10
$
```

```
$ gfortran ompds111_2.f90 -fopenmp; ./a.out
          11
$
```

```
$ ifort ompds111_2.f90 -qopenmp; ./a.out
          11
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to