<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94177>94177</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Compilation error when capture-statement described in atomic capture construct contains a different type
</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(8930ba98e01bc66949e482b396f8389d64388359)AArch64
```
When `capture-statement` described in `atomic capture` construct contains a different `type`, the compilation terminates abnormally.
Although the results of this compilation and [#93441](https://github.com/llvm/llvm-project/issues/93441) are different, they seem to contain similar issues.
Compilation ends normally in the following cases:
- Do not specify the compilation option (`-fopenmp`)
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
OMP_3_O_007_4_atm_type_049_fo_222.f90:
```fortran
subroutine sub2()
real(kind=4) :: s_x_r2
real(kind=16) :: s_v_r16
complex(kind=4) :: s_expr_c2
s_x_r2 =10.0
s_v_r16 = 10.0
s_expr_c2 =(10.0,0.0)
!$omp atomic capture
s_v_r16 = s_x_r2
s_x_r2 = s_x_r2 + s_expr_c2
!$omp end atomic
write(6,*) "s_v_r16 = ", s_v_r16, " s_x_r2 = " , s_x_r2
end subroutine sub2
program main
call sub2()
end program main
```
```
$ flang-new -fopenmp OMP_3_O_007_4_atm_type_049_fo_222.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40_EXA/OMP_3_O_007_4_atm_type_049_fo_222.f90":7:3): the type of the operand must be a pointer type whose element type is the same as that of the region argument
error: verification of lowering to FIR failed
$
```
```
$ gfortran -fopenmp OMP_3_O_007_4_atm_type_049_fo_222.f90
s_v_r16 = 10.0000000000000000000000000000000000 s_x_r2 = 20.0000000
$
```
```
$ ifort -qopenmp -diag-disable=10448 OMP_3_O_007_4_atm_type_049_fo_222.f90
s_v_r16 = 10.0000000000000000000000000000000 s_x_r2 = 20.00000
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vt-Po7YT_2ucl1EiZyAEHvKQ23z5qpVOd6pObd-QgSH4zmBqm83uf1_ZQDbZvd5dWzWKANvjmfnMb2GtPPdEB7Z7x3anlRhdq81Bt71eN59Xpa6fDyzh85-fGD_-SsZK3YNuoFGiP697ugCLjrDNNnzDGaZpFvFSZCnxbVklSRZnFKdYRlnSpFGa1UkcpWm0yxhmx6Op2iSeOL8SND1_a6kHlvBKDG40tLZOOOqodyzhUJOtjCypBhmIhNOdrGCm9RSV7q0zY-X8lxOytyCglk1Dhnrn77jnwVMyfADXElS6G6QSzkN0ZDrZC0cWRNlr0wmlnje32h2Va_V4bsNVQ3ZUznrLuFbaO1air8HbGKMsiuMt250Ypq1zg2XRkWHOMD9L147lptIdw1ypx-W1Hoz-TJVjmEtrR7IM84kJZiAMvcCZMTyDJerA6QUzWNlJJQxM9-8QPNwoSX1tYcHpTepRNVopfZH9GSphKagbLq7hpKHXDuxAlWye31hPD-HFMGUJXzd6oL4bgqWzWwWm56c7SR6VZ-fIOhiMPhvReXD5EnB-8f9GG2fEZFvpF7fiGeb0RNUYdJg8c4f7w_uPRVR8KDjfF3EhXFf4QCh4nBWNLhBx02T8CvYamrPMadeOpdGjkz2BHUv0SBdsAIaEYph-kX3NolPsnQXgE8XnCtjiqTD4ddptMhG_0D4WZpvMxB6joqdXrF9o6WkwRXVlPQkCz9Zn53U3sPTbcLN_ve0PGKbhCB_Cc3EabhnGuhvgVbJ9hfMdyFmRmwNg-O61wi_sqa9nEQvri5GOGKYJwweGxwAb8VYgQ_SRsRgMH_zOjQnCcqJ40cwLeu3Jm0CZww86IftFk0oo9cblns9b4q8WtdebGN_U0iVV4MdCdJJtjDY-AJSugk7IML9o84Vh3uqOGOa-pjPMHz4xzH1eMcx9MPvVwDA3NBhdjxWZn8NJNxS6G2Je_O93X59-TBdEFh33LDpG3ir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