Issue 91929
Summary [Flang][OpenMP] Compilation error when the variables used in an `update-statement` in `atomic` construct are declared with different types
Labels openmp, flang
Assignees
Reporter ohno-fj
    ```
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
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to