Issue |
81099
|
Summary |
[Flang][OpenMP] Compilation error of `atomic update` with `MAX` for variables of different types
|
Labels |
openmp,
flang
|
Assignees |
|
Reporter |
yus3710-fj
|
This is an issue from Fujitsu testsuite.
Flang-new terminates abnormally when compiling in `atomic update` with `MAX` for variables of different types.
Gfortran emits error messages even if OpenMP is disabled.
The following are the test program and the compilation results of Flang-new and gfortran.
```fortran
! test.f90
program main
call isub1()
end program main
subroutine isub1()
integer*1 i1x, i1y
integer*2 i2x, i2y
integer*4 i4x, i4y, calc(6),res/4/
integer*8 i8x, i8y
real*4 r4x, r4y
real*8 r8x, r8y
data i1x,i2x,i4x,i8x,r4x,r8x/6*-2/
data i1y,i2y,i4y,i8y,r4y,r8y/6*4/
!$omp atomic update
i4x = max(i4x , i1y)
!$omp end atomic
calc(1) = i4x
i4x = -2
!$omp atomic update
i4x = max(i4x , i2y)
!$omp end atomic
calc(2) = i4x
i4x = -2
!$omp atomic update
i4x = max(i4x , i4y)
!$omp end atomic
calc(3) = i4x
i4x = -2
!$omp atomic update
i4x = max(i4x , i8y)
!$omp end atomic
calc(4) = i4x
i4x = -2
!$omp atomic update
i4x = max(i4x , r4y)
!$omp end atomic
calc(5) = i4x
i4x = -2
!$omp atomic update
i4x = max(i4x , r8y)
!$omp end atomic
calc(6) = i4x
end subroutine
```
```console
$ flang-new -v test.f90 -fopenmp
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git 61ff9f8db8d18002767ea27f83a4bfb8ed47f255)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
Found candidate GCC installation: /opt/rh/gcc-toolset-12/root/usr/lib/gcc/aarch64-redhat-linux/12
Selected GCC installation: /opt/rh/gcc-toolset-12/root/usr/lib/gcc/aarch64-redhat-linux/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/path/to/install/bin/flang-new" -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -mframe-pointer=non-leaf -o /tmp/test-3ff5d4.o -x f95-cpp-input test.f90
error: loc("/path/to/test.f90":30:3): no atomic update operation with region argument as operand found inside atomic.update region
error: loc("/path/to/test.f90":30:3): LLVM Translation failed for operation: omp.atomic.update
error: failed to create the LLVM module
```
```console
$ gfortran -v test.f90 -fopenmp
Driving: gfortran -v test.f90 -fopenmp -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/8/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-18) (GCC)
:
test.f90:33:15:
i4x = max(i4x , i8y)
1
Error: !$OMP ATOMIC intrinsic arguments except one must not reference ‘i4x’ at (1)
test.f90:38:23:
i4x = max(i4x , r4y)
1
Error: ‘a2’ argument of ‘max’ intrinsic at (1) must be INTEGER(4)
test.f90:38:11:
i4x = max(i4x , r4y)
1
Error: !$OMP ATOMIC assignment must have an operator or intrinsic on right hand side at (1)
test.f90:43:23:
i4x = max(i4x , r8y)
1
Error: ‘a2’ argument of ‘max’ intrinsic at (1) must be INTEGER(4)
test.f90:43:11:
i4x = max(i4x , r8y)
1
Error: !$OMP ATOMIC assignment must have an operator or intrinsic on right hand side at (1)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs