Issue 81100
Summary [Flang][OpenMP] flang-new doesn't report a wrong usage of `atomic capture`
Labels openmp, flang:frontend
Assignees
Reporter yus3710-fj
    This is an issue from Fujitsu testsuite.

Flang-new doesn't emit a correct error message for a wrong usage of `atomic capture`.

The following are the test program and the compilation results of Flang-new and gfortran.

```fortran
! test.f90
integer :: vv,yy,yy1
vv=1
yy=1
yy1=1

!$omp atomic capture
vv=yy
yy=yy+yy
!$omp end atomic

!$omp atomic capture
vv=yy
yy=(yy1+yy)+yy1
!$omp end atomic
end
```
```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-af2dc0.o -x f95-cpp-input test.f90
error: loc("/path/to/test.f90":4:1): no atomic update operation with region argument as operand found inside atomic.update region
error: LLVM Translation failed for operation: omp.atomic.capture
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:9:3:

 yy=yy+yy
   1
Error: expr in !$OMP ATOMIC assignment var = var op expr must be scalar and cannot reference var at (1)
test.f90:14:3:

 yy=(yy1+yy)+yy1
   1
Error: !$OMP ATOMIC assignment must be var = var op expr or var = expr op var at (1)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to