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

    <tr>
        <th>Summary</th>
        <td>
            [flang][OpenMP] copyprivate fails to lower pointers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang,
            flang:openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          luporl
      </td>
    </tr>
</table>

<pre>
    Using pointers in copyprivate clauses results in an error when lowering.

```f90
subroutine test4
    implicit none
 integer, pointer :: p

    nullify (p)
    !$omp parallel private(p)
        allocate (p)
    !$omp single
        p = 42
 !$omp end single copyprivate(p)
    !$omp end parallel
end subroutine
```

```
error: loc("/app/example.f90":7:11): 'fir.convert' op invalid type conversion'i32' / '!fir.box<!fir.ptr<i32>>'
error: Lowering to LLVM IR failed
error: loc("/app/example.f90":7:11): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
```

Godbolt link: https://godbolt.org/z/j6Wh5scj1
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE2P4zYM_TX0RdjApuw4OfiQndTFArNoUfTjLNt0oqksCZKc3emvL2h7PlvMZRPDiUk-8vGJpopRXyxRA9VnqM6ZmtPVhcbM3gWTdW54bP6I2l6Ed9omClFoK3rnH33QN5VI9EbNkaIIFGeTFreygkJwQXy7khXGfaOg7WUH-Rny03bf5-s1HvPVEucuuDlpSyJRTOVqFUIIPXmje52EdZY2M3O5UAC8eyImQJ5AnoR_XYbhdjZGj48C8OABjy8OwAKwdJMXXgVlDBmxNfWfUP4oY1zPHX-QiJUy9BbnBcizKHGzvgSTHTbAa0E_yM6AJ6qrf0nxLNw7af9X7w3Hx8NqGdcDHgARsFXeA7b0XU3e0I4PBhHkqQZ5KgqmJJl9Peqw6529UUiAtXBeaHtTRg8iPXpuhV1ROwtYa4kcA9gyErBgcOe-g7zbHnwKIO84Tv7EF9bvGN5v4yOSE_f3f34VX34To9KGhh9spVfWuiS6J8qJhlc1OGLScRl92Ods_T0oG41K2tmzVob69IUHb1Q9wT4XgS46prD4xeiCGNag5b_znHCcbb_j2zvqaz9cvQ_EI5autBKZ3DCbjw72Zzd0ziRhtP2bU11T8pFfBWwB28vq3blwAWz_AWwf9n9dq9g_FNnQyOEojyqjpqiLw17WdX3Irs2hwOrA37rvelnkWEmlcKCKSHZjOWa6wRzLfF_URYVYHXb7HEuVl1WFw1hiWUKZ06S02Rlzm7h2pmOcqTlWh7zIjOrIxGXfII5G2ctyZnfPT_LkPNnJs7k6Z6HhNJ-6-RKhzI2OKb4kTjqZZXet0OoM1edfPNmvv0J1frOnWOPIEi_76HmdZXMwzTvRdLrO3a53E2DLlbafTz64B-oTYLv0EwHbtaVbg_8GAAD__zS7mF8">