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

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Compilation error when the variables used in an `update-statement` in `atomic` construct are declared with different types
        </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(1a498103ee5c4d101e70dc49db11938d8b87b518)/AArch64
```

When the variables (`x` and `expr`) used in an `update-statement` in `atomic` construct are declared with different types, a compilation terminates abnormally.  
When both variables are declared of the same type, a compilation terminates normally.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

OMP_3_O_007_4_atm_expr_027_up_323.f90:
```fortran
program main
  integer(kind=4) :: s_x, i
! integer(kind=4) :: s_expr
 real(kind=4)    :: s_expr
  s_x    = 3
  s_expr = 3.0
!$omp atomic ! update
  s_x = s_x + s_expr
!$omp end atomic
  write(6,*) 's_x = ', s_x, ', s_expr = ', s_expr
end program main
```

```
$ flang-new -fopenmp -L${LLVM_DIR}/lib OMP_3_O_007_4_atm_expr_027_up_323.f90; ./a.out
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/OMP_3_O_007_4_atm_expr_027_up_323.f90":6:3): no atomic update operation with region argument as operand found inside atomic.update region
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/OMP_3_O_007_4_atm_expr_027_up_323.f90":6:3): LLVM Translation failed for operation: omp.atomic.update
error: failed to create the LLVM module
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp OMP_3_O_007_4_atm_expr_027_up_323.f90; ./a.out
 s_x = 6 , s_expr =    3.00000000
$
```

```
$ export OMP_NUM_THREADS=2; ifort -qopenmp OMP_3_O_007_4_atm_expr_027_up_323.f90; ./a.out
 s_x =            6 , s_expr =    3.000000
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVl-TmzYQ_zTyy44ZsYCBBz_4zqV_Jtdk0mv6yMiwGCUgUUnEl2_fEWCfz8mkaaeZKXNzWNLub___kLBWHhXRliV3LNmvxOhabba6VXrdvF8ddP1pyzZ8-eN7xnfvyFipFegGmk6o41rRCVi0gzAPeMAZZqGI8yzkEVFSxXXIQ0p5XcV5fQjDPMrq7JClhyTMGOYMi93OVO0mnsFvbM3__2hJgWsJPgojxaEjCwwztuFPbMNBqBrYhtPTYLwe5jBaqkEqEMofjEMtHK2tE456Us7ryOlEON3Lyq8rrawzY-VAGIKaqk4YquEkXQu1bBoypBy4TwNZhvcgoNL9IDvhfCIcmV4q4ciCOChtetF1nwKAK-cP2rVX3r8wopspNit6mix81cAF_jo_jy1Bo7tOn6Q6TuAe0JF1MBh9NKL3mMW5WH7xY6ONM0JN2ZN-cW2RYUFPVI2TdUN27NwLg68f3pRR-brkPC3jUri-9NkvOablOJQRRkGTcxbtbmq62Jx3F8-gF3LZAZDK0ZEMw-yDVDWL9rEvpweKdmDLJ--5XEAx_DvxqSNmZEOiuxED-KKkNzOf7SF63vMS817ALw4wjHU_wNxG4D2ae-0ayutMb7x7YehZnVS9QJz1TkY6YphtGN4z3E1BYXpGY5j6PCzpuKwuHr7YmSG9ic_z_cVZu93E-GrK140eSPUDrF8xjFl69-rVu4dy__Nblu4ZFp08wDe2xh0EDAsR6NEtLhqjja9Gpys_3IgMi5M2HxgWre6JYeFJiWFx_8iw8M3NsPAd5VcDw8LQYHQ9VmR-mU76odT9EHOGxbc5hcii3YZFu8gTU7QDpc-1nesKeiAzj-TEDIaO_rcwx9ETCwg7S6gaGj36wVJW1rSABAvIrPX_jdrXFB6NUHahn0bIjnxI5jkBXlD3Q_AitJuYFj2noTLkI_esNKH3uh47unTYP2tHeho8Xfnofv39oXz86e0Pu_1vLNqjb6v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