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

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] verification of lowering to FIR failed with "'fir.store' op store value type must match memory reference type"
        </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/j6o13x97x

Reproducer:
```f90
integer, pointer :: a
integer :: arr(20,10)
integer :: i

!$omp simd lastprivate(i)
do a = 1, 10
  do i = a, 20
    arr(i, a) = i + a
  end do
end do

end
```

Compilation error:
```console
$ flang-new -fopenmp test.f90
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
warning: loc("/tmp/test.f90":1:1): OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed into 64 bits.
warning: loc("/tmp/test.f90":1:1): OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed into 64 bits.
error: loc("/tmp/test.f90":5:7): 'fir.store' op store value type must match memory reference type
error: verification of lowering to FIR failed
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVE2P4zYM_TX0hUhg03YSH3zIbOCih6LFXnqWbTrRVhYFSU5m9tcXsmd20-2hPfRQILHpJ348PhFUIeirZW6hfoH6kqkl3sS3f-yU9_IIWS_jW_uZnZdxGXRvGMXiTzL2YiKUZ8jPtxhdSCZ1QN11O9qLvwJ1X4G6Lwcpytfm-Ap5cv_IxX4Lh0O-_aYmh_ysbeQre6BP6CR9eEx-5RnV99NvkPdAJ8qBPhU5UPN3D70VBSqAKpkdBj2PaFSIzuu7igx00lvkKKgQygsWqXiRyCCOgnoFVQJpA_G9sE6YAmpWD41ALytLRLYjjgL5-Zux2c_9buAnmZ02KmqxyN7Lj6oMYoMYXnuocDLKXneWH7ibxLGdHUYOcb9pt51Snhp_KG-1vSbzV8f2l98wLM6Jj6jtlgZ1wBC1Mcivjr2e2UZlEOqX3e_PyE5cYgf1BfLzU1ojA9AJiIC6OLv0_KBCBOW5WP_UPFEwIg51ZL_1e1deqzRSg7JWIt7UnXEWzxhvyuKhwl7HgEF_ZVR2xEci2zPadTZ5RG2jfLjt__fsPq73H7nVUJ6P79yAjpP2-xDFM9ARxeFq412ZhTG-OcZ5CRFnFYcbzjyLf0PPE3u2w-bwXPvOXk962FqUCY082Gt7xSjY_fwZJ6UN_2VOs7Etx6ZsVMZtcSzr6liVzTG7tXzoqTidqkM-DKUqy7EcD9PYH5jVwM1JZbqlnKqCqCmoKIvj_sBM_VQchrFWZVkRVDnPSpu9Mfc5rYxMh7BwW1BBTZ4Z1bMJ62YiWmc26VNfMt-mgF2_XANUudEhhu8poo5mXWfdGlFfoH7Zbhjqy7_sHx863nC9of9AfqJs8ab9YVHqeFv6_SAzUJfIv792zssXHiJQt4oRgLp3Pe4t_RkAAP__mGnIYA">