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

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Incorrect execution result of an assignment statement in task construct in taskgroup 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 : 19.0.0(1a498103ee5c4d101e70dc49db11938d8b87b518)/AArch64
```

The attached program (An assignment statement in `task shared` construct in `taskgroup` construct) has incorrect results.  
When `task shared` construct is removed, the results are correct.

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

taskgroup_003_22.f90:
```fortran
program main
 integer, dimension(10) :: a
  a = 0
  write(6,*) "1 : a = ", a
!$omp parallel private(i)
!$omp sections
!$omp section
!$omp taskgroup
  do i=1,10
!$omp task shared(a)
!$omp atomic write
 a(i) = 1
!$omp end task
  end do
!$omp end taskgroup
 write(6,*) "2 : a = ", a
!$omp end sections
!$omp end parallel
end program main
```

```
$ flang-new -fopenmp taskgroup_003_22.f90; ./a.out
 1 : a =  0 0 0 0 0 0 0 0 0 0
 2 : a =  0 0 0 0 0 0 0 0 0 0
$
```

```
$ gfortran -fopenmp taskgroup_003_22.f90; ./a.out
 1 : a =            0           0           0           0 0           0           0           0           0           0
 2 : a = 1           1           1           1           1           1 1           1           1           1
 $
```

```
$ ifort -qopenmp -diag-disable=10448 taskgroup_003_22.f90; ./a.out
 1 : a = 0           0           0           0           0
           0 0           0           0           0
 2 : a =            1           1 1           1           1
           1           1           1 1           1
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVk1z8yYQ_jXowlgDq--DDk487vTQaQ-d9vgOktYSbyVQASXtv--gj8Rx7NTJm3hsWJZndx-WZYW1slWI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