<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60741>60741</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Assertion failure in array element update in atomic construct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
flang:ir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
NimishMishra
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kiranchandramohan
</td>
</tr>
</table>
<pre>
An assertion failure is observed while trying to compile code with Atomic construct containing array elements.
```
OpenMP.cpp:1663: void genOmpAtomicUpdateStatement(Fortran::lower::AbstractConverter &, Fortran::lower::pft::Evaluation &, const Fortran::parser::Variable &, const Fortran::parser::Expr &, const Fortran::parser::OmpAtomicClauseList *, const Fortran::parser::OmpAtomicClauseList *): Assertion `name && name->symbol && "No symbol attached to atomic update variable"' failed.
```
**Reproducer**
```
subroutine s()
use omp_lib
integer :: tid, stat(100)
stat = 0
!$omp parallel shared(stat) private(tid)
tid = omp_get_thread_num()
!$omp atomic
stat(tid) = stat(tid) + 1
!$omp end atomic
!$omp end parallel
end subroutine
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMFu4zYQ_RrqQsSQSVmODjoocXzqdosW7TUYkWOJLUUS5Mhp_r6gJCebdAssUMCQqSe9p5k3DwMpmcEhtuzwwIT42UwmjV9MGiMwIdjhVMBMo4_tXyaCUyM4HWHyI7ii9_q17RyHlDCS8Y5fwNg5IjeJ-z5hvKLmL6OxyCm-Gjdw8lz5KWREeY38xdDIO_KTUVx5lyjOivKJwLhMgBjhlaPFCR2lHStPrOy2a11uv-X2a0D35ZedCoHJbl_XksmOX73RfED3dQrrV34PGgh_I6BFkYn7s48UwTHZMdlZ_4JxPXZ9ogiKHr27YiSMnImaiUf-X4RwofXwdAU7w2LIRlla-0gMENON-QdEA73FH3z96e8Qf_DVt74fLcwJfzKJOBPd_2E22dfubeSsLh1MW-k1z-c7Jp_S69R7e0NzsDzfMCACNaLOYYB19PMyFX7dfMjBE8clTah33532ds0Fdb9iiF7PCuN6_11CmvvoZzIOeWLiPvex4JzPCbmfwrM1_Q0yjnDIE1-s4GR0diwR5MDsy_IbdgY5kyde3hAm9kxUfgo8QARr0fI0QkTNxP0q0fAQzRUImbhftN_UyOhFLNczID3TGBH0s5unjzW_f2N18IbzW5Gr7KL1CREPfP9vGXT6k9THZ7dW1qcZeTf0k9-FbqVuZAMFtvv6WMtjcyirYmzVRTayOqIGcQFQ-gjHWqmL1JdGVHUlC9OKUshS7Ku9ONyLalc1l0rISjTNUfdKCVaVOIGxO2uv087HoTApzdjW5bHaFxZ6tGlbZD6gm8KSpEcmxMWCG5jsTNy2Wmyzxl0_D4lVpTWJ0rsqGbLLRjwvtMOJHR7W_cIOp2_C_7bv3MdFdQt0xj8tt2KOth2JQsrhEmcmzoOhce53yk9MnHMN299diP5PVMTEeWkzMXFeOv0nAAD__8GZxOU">