<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/83722>83722</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] verification of lowering to FIR failed with "the type of the operand must be a pointer type whose element type is the same as that of the region argument"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Reproducible on Godbolt
https://godbolt.org/z/P8qY5PqMd
Reproducer (reduced from https://github.com/gcc-mirror/gcc/blob/master/libgomp/testsuite/libgomp.fortran/omp_atomic4.f90)
```console
$ cat omp_atomic4_reduced.f90
real :: c
double precision :: c2
!$omp atomic capture
c2 = c
c = 2.0 * c
!$omp end atomic
end
$ flang-new -fopenmp omp_atomic4_reduced.f90
error: loc("/tmp/omp_atomic4_reduced.f90":1:5): 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
```
If I change `c = 2.0 * c` in the program into `c = 2.0`, the following is obtained. So I think this is related to (or essentially identical to) https://github.com/llvm/llvm-project/issues/83144.
```console
error: address must dereference to value type
error: verification of lowering to FIR failed
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VMFu4zYQ_RrqMrAhjyTbOujgraEih0UX21NPC4ocSexSHC1JxUi_vqCUxGmABgVaFDDk4fDN4-PjkDIEMziiRlSfRHXN5BJH9s33nfSebyHrWD81X2n2rBdlOkvADn5m3bGNIr-K_DLGOAdRXAS2Atthm9qzHwS2fwhsv5x__FZ9-fFZb_Dt-8JIHgSePaVQQ-95gnd8Jo5Lt1c8pYFSu8l4z34bCGw7y53AdpIhUspa0w08zQLbSCGGxUS6Z_c9--ilE9jyNH-TkSejyn1f5wLrZ3nHfPspdoEtPWexBCUjvKn69ix6rV5BAACepIUkvriAuqc1L8m62ZMywbB7heAL_0FgydMMGzsoOcfF051BIYji-pZTrQnc5yDwdbE7ETn9TLbNkNP3vfRWumHn6Aa7nmdy0_zx1mj1vLiAZSXwLBCTwavNf1eHKIrLQRSXKnlbXCCOBPFpJuB-jXkmL52GaQkROgIJMxsXyW-o28iBgCxN5OKWMmEtDHIikClOJ7KReRqSrdIPS8K_U_1I3vRGyZgw3IPlG3njBogM7cNX6KWxpN81wNt2fejhAdQo3UCQeuOd9cccjFt1zJ4HLycwLvJfkIkQf1oxPVvLt7S8CcBdlMaR3sOvDA8QR-O-p29Ik56sjKSTTIFn9kAhkItGWvsERqdQSQuRBdYf3RtrH1_-drPn30lFga0JYaEgsD0Xh7Lcf9T_r05KrT2FsB2aJk89eXKKksRHaZftiP8L-zPdFLouaplRczjldXnK87zOxqYsdSW17LCvi546pWV1OJUd6UIfj4fzKTMN5ljmRV4csDyW9T4_HE94VHXeV6iPRyXKnCZp7D4Zkl6qbLWiORcnxMzKjmxY30PE9aKkXq6umW9WA7tlCKLMrQkx3BmiiXZ9RNu1orqK6tMvM7nPX0R1_YcOwM3EEQTi_3pVELPF2-bftM8J8c8AAAD___EC_8k">