<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112908>112908</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][OpenMP] support arrays of atomic numbers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
crash-on-valid,
flang:openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tblah
</td>
</tr>
</table>
<pre>
Support for atomic operations on scalar complex variables is being added in https://github.com/llvm/llvm-project/pull/92364.
flang also supports atomic operations which read a single element from an array. The openmp standard says that the lhs and rhs of the assignment must be "scalar variables of intrinsic type" (OpenMP 5.2 section 4.3.1.3). The result of the expression on the rhs must be scalar but the expression might involve arrays.
Currently (and after #92364) Flang will crash on an assertion on this code:
```
program atomic_array
complex :: x(2)
complex :: y
!$omp parallel
!$omp atomic read
y = x(1)
!$omp end parallel
end program
```
Reproduce with `flang -fopenmp file.f90`.
CC @NimishMishra
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4zYM_TXyhRjDpuUkPvgwO0Fu2xZt74Vs0ZEKWTJEOTP594U_Mtkd7KVAoMCkSL5HPkox26snakX9TdTnTM3JhNimzimTdUHf27_maQoxwRAiqBRG20OYKKpkg2cIHrhXTkXowzg5-oCbilZ1jhgsQ0fWX0FpTRqsB5PSxKJ6FXgReLnaZOYu78Mo8OLc7fH3MsXwL_VJ4GWanRN4abA6yFwUZ1G8bufg1JLYcQDeAPIv0L0b2xuIpDQoYOuvjoAcjeQTDDGMoDyoGNU9h78NLZF-nICT8lpFDazuDMmoBMkQOMOgvIZoGMKwmrburenGmRN0BAJxb8izEWEA61O0nm0P6T6RQASBp98n8t__gDpHYOoXyCDzKi_zSmCzQYrEs0uPevQxRWJeLga_WhYwj9J73W5OXy-P9moSWH8L7kYbY_6pnW9zjOSTuy-wFpJqSBRBYLW2XmADl7Xj79Y56KNisyBY2sdMMX0isgx90LTMeEt_KPbf-jnFcI1q3Ef1z4pk88CngJbY6hU-BJ5QYLO7v3g_owSWAmUYJ5hUVM6Re3h-9O3SWJTwdAPcQVTntVL5rPRDGHn9Je1q2Uj8kuB2_klTDHruCd5tMiAOxabXl2GX2GAd5UOzxP08hzcQsvjNjpbNd8smqky3lW6qRmXUlkds8FCixMy0TXdqDvJYH0n2WPWqKuRR9_Iw1LrTRdNntsUCZVmUp1JiITEnJeuy7GQlm7454knIgkZlXb4sXR7iNbPMM7VliU1xypzqyPH6MCCuI38J_uWmnNUCUeCbQFxpiep1o7WY63MW23WLu_nKQhbOcuJniWSTW1-bLbQ-i_rbtgeiPj92eZfoIvt9cn4eO4qczdG1__sVWWmxwMvO7NbifwEAAP__irGWGA">