<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/78938>78938</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Incorrect execution result of a do-variable defined as shared in parallel construct
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp,
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
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
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU2TnDYQ_TXi0jWUaEYMHDjsLp4kh_W6EifXLQESyKWRiCTWdn59SgzztWtXDknFU1Oi1DRPr19_iHuvBiNETdg9YU3C5zBaV9vR2I38lLS2_1qTgq5_2hB694dwXlkDVoLU3AwbIz4Dye8gK1OaUoIllaIsZNWxrJRthlXRtrzsi6IT24rJqpdSYrfNGcHqCLmut-cc1zsgBe3t5oU7xVstSEGhF1IZ0QP38aUfuRN9tCsT9xN3XGuho6Wzxgc3dwFg5B64AWU665zoArxwPQvgMggH4ovo5qDM8F2AFOD7hJS_Qmi_LiBOvfAQ3xJ8AGPDDdX0OsSPowBptbaf4-fcCQijgCB8gMnZwfFDhNiftI6bn6R1wXED3PSg4gY6e5iU5kFZQ3C_0rEGnPCzDjcHejMMf7Fi94yYyoqS_HUCVvTVe26djaEJ8NnRBGoieZPRNVMAakKSN5uzhWBGcGsPE5zEhDV2LNVEsIKTPnGP50IAaJ5ATUDyBhbhTgfCu_cNNE83XvgPbhcSwvRnIqvn5JQJQPCO4APBnZpgZQixlgnuCD6o6QT7xhtPAVx749E9nvYN0Y7rmlE4cGVO6B3X-uy2cH3j9M3eeG3ELYgvUyyGp8cPz-9_f3z--POv7-6a30jeIMnvr_p1I-0kzGGCN7VwDynBPU_tHM7JvtEGLnl_pQNcF8D2vyQ-nOr93_C-_PD_5n9s0c2fP5Z80td5X-UVT0Sd7SirKM1pmYz1Tuw6VjFkklJR5LyQjDJsuxbLgmFWJapGiluaIVKWZdsy7bKKdUJgzyQrMtGSLRUHrnSq9cshtW5IlPezqHdllZeJ5q3QfrljEI8aEMSll3CpybhjTeLq-PmmnQdPtlQrH_wFMKigl3tqmYSENYTdP03CPH4grIFfznP99eiLFxWHq4l9fX-sEitzGVTnkZ_MTtdjCJNfenxPcD-oMM5t2tkDwX1ktj42k7OfRBcI7pe4PcH9EvrfAQAA__-zhh1s">