Issue 78938
Summary [Flang][OpenMP] Incorrect execution result of a do-variable defined as shared in parallel construct
Labels openmp, flang
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 18.0.0(0fe86f9c518fb1296bba8d66ce495f9dfff2c435)

```

A `do-variable` defined as `shared` in `parallel` construct  has an incorrect value after executing `parallel` construct.  
A `do-variable` is executing by `private`, not `shared`.

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

snggz567_22.f90:
```fortran
subroutine s1
 ip=100
  ip2=-100
!$omp parallel shared(ip) private(ip2)
  DO ip = 0, 1
  END DO
  DO ip2 = 0, 1
  END DO
!$omp end parallel
 print *,'ip  shared  :',ip
  print *,'ip2 private :',ip2
end subroutine s1

program main
  call s1
end program main
```

```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp snggz567_22.f90; ./a.out
 ip  shared  : 100
 ip2 private : -100
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp snggz567_22.f90; ./a.out
 ip  shared  :           2
 ip2 private : -100
$
```

```
$ export OMP_NUM_THREADS=2; ifort -qopenmp snggz567_22.f90; ./a.out
 ip  shared  :           2
 ip2 private : -100
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to