| Issue |
165184
|
| Summary |
[Flang][OpenMP] Incorrect execution result when using double precision complex in a statement within ATOMIC WRITE construct
|
| Labels |
flang:openmp
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang : 22.0.0(ea3dbb8b0061a7e44cba92b6e4e4486c4a416d65)/AArch64
```
In the attached program (`sngtatm029_21.f90`), when using `double precision complex` in a statement within `ATOMIC WRITE construct`, the execution result is incorrect.
The same issue also occurs with `quadruple precision complex`.
In the following cases, the execution result is correct.
- Do not specify the compilation option (`-fopenmp`), or
- Remove `ATOMIC WRITE construct`, or
- Change `double precision` or `quadruple precision` to `single precision`, or
- Change `complex` to `real` or `integer`
The following are the test program, Flang, Gfortran and ifx compilation/execution results.
sngtatm029_21.f90:
```fortran
program main
complex(8)::c81
complex(8)::c82
c81=0
c82=0
write(6,*) "1 : c81 = ", c81
!$omp parallel
!$omp atomic write
c81=c82+(1.0_8,1.0_8)
!$omp end parallel
write(6,*) "2 : c81 = ", c81
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngtatm029_21.f90; ./a.out
1 : c81 = (0.,0.)
2 : c81 = (1.,0.)
$
```
```
$ flang sngtatm029_21.f90; ./a.out
1 : c81 = (0.,0.)
2 : c81 = (1.,1.)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngtatm029_21.f90; ./a.out
1 : c81 = (0.0000000000000000,0.0000000000000000)
2 : c81 = (1.0000000000000000,1.0000000000000000)
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngtatm029_21.f90; ./a.out
1 : c81 = (0.000000000000000E+000,0.000000000000000E+000)
2 : c81 = (1.00000000000000,1.00000000000000)
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs