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

    <tr>
        <th>Summary</th>
        <td>
            [flang] [OpenMP] Compilation Error (from NPB 3.4.2-MZ-OMP)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    I observed compilation errors when building NPB 3.4.2-MZ-OMP with flang-new. Here is the minimal reproducer:
```console
$ cat mz.f90
module mz_data

   integer t_last
   parameter (t_last = 15)

end module mz_data

program test

   use mz_data

   integer i
   double precision tsum(t_last), trecs(t_last), tming(t_last), tmaxg(t_last)

   do i=1, t_last
      !$omp atomic
      tsum(i) = tsum(i) + trecs(i)
 !$omp atomic
      tming(i) = min(tming(i), trecs(i))
      !$omp atomic
      tmaxg(i) = max(tmaxg(i), trecs(i))
   end do

end program
```

Gfortran:
```console
$ gfortran -fopenmp -Wall -Wextra mz.f90
$
```

Flang:
```console
$ flang-new -fopenmp mz.f90
error: Semantic errors in mz.f90
./mz.f90:19:18: error: Atomic update variable 'tming(i)' not found in the argument list of intrinsic procedure
        tming(i) = min(tming(i), trecs(i))
 ^^^^^^^^^^^^^^^^^^^^^^^
./mz.f90:21:18: error: Atomic update variable 'tmaxg(i)' not found in the argument list of intrinsic procedure
 tmaxg(i) = max(tmaxg(i), trecs(i))
 ^^^^^^^^^^^^^^^^^^^^^^^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU2PpDYQ_TXmUgKBge72gUPP9naSw2RHymGlXFYGF7QTfyDbzEz210dmWIbeUSazmpUQLZfteo9Xr7q493IwiA2pb0h9SvgULtY1f6fcOfvgk9aKf5rfwLYe3T0K6KwepeJBWgPonHUeHi5ooJ2kEtIM8PvdDZRZldH09s_00-0dPMhwgV5xM6QGHzL4FR2C9BAuCFoaqbkCh6OzYurQkfJI8hPJj2SXPz2dNd4qXKK0go4H0F-znuVPMW3FpBD01y-CB76cm98AIE3AAR2EL4r7sIZH7rjGgA4IPTztASlPUNSEsm0KNAL-G2B0dnBcQ8BvuVeEyf8fJblGhJ1ahTA67KSPygY_6ZVYZEQ_QHDY-RdBLc3wMsgfr4PXBIQFScpTMZ-91gUACC0IrawegQerZbfdW3hJQtks19Wa3qwc5Qr6erqF_ZpPSxN5b8LbL39aszeTXWR4zs4f5-zP4deyx8oL-70Xlop_59HtqV9664Lj5g1OHpajkPZ2RKNHSD9zpSD9jI_B8SuXE1q9AnqO_fUGxLUPnyG3IHNHk_IIf6DmJsjuW49Lc3UuI_S8rMtjweLrEK-t949zNWAaBQ8I99xJHh1O6P66uHswNkBvJyMiRvxP4G6YNJoASvoAto_94qTxsovidygmh9syv9NGpP74E56XqtDix1TZmvJ9qrzL9z9RjtWFiWhKwUrGE2yKHcvZoaJ7llwanudMsJqx9sBZhR0v8rZo9_1O4G4vyjKRDc1pmR9yWpR1UbCsOLBuj3VFy11RdMWeVDlqLlWm1L3OrBsS6f2Eza4qqypRvEXl59FGaTT9vEkojZPONfFO2k6DJ1UeZfXPWYIMap6Jc8OQ-gSkvvk0orm9i4sPmyn4MVY3jpHeWf1i_BHKksmp5hLC6GOD0jOh50GGy9RmndWEniPo8pOOzv6FXSD0PFP1hJ7nT_k3AAD___c5Mng">