Skip to content

[Flang][OpenMP] Compilation error of atomic construct #75138

Closed
@ohno-fj

Description

@ohno-fj
Version of flang-new : 18.0.0(770dc47659d41a5ca7b7daf5b3134c900ca8c33d)

atomic construct results in a compilation error.

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

omp_PL_ATOMIC_001c_3.f90:

      program main
      complex*8 ia, ib
      integer*4 :: loop=10000
      ia = (0,0)
!$omp parallel
!$omp do
      do i=1, loop
!$omp atomic
         ia = ia + (1,1)
      enddo
!$omp end do
!$omp end parallel
      end
$ flang-new -fopenmp omp_PL_ATOMIC_001c_3.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_add00/omp_PL_ATOMIC_001c_3.f90":7:7): 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_add00/omp_PL_ATOMIC_001c_3.f90":7:7): LLVM Translation failed for operation: omp.atomic.update
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_add00/omp_PL_ATOMIC_001c_3.f90":6:7): LLVM Translation failed for operation: omp.wsloop
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /lustre/home/ohno/LLVM_20231130/release/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o /tmp/omp_PL_ATOMIC_001c_3-814ed2.o -x f95-cpp-input omp_PL_ATOM\
IC_001c_3.f90
 #0 0x0000000003f7d7b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3f7d7b0)
 #1 0x0000000003f7b6b8 llvm::sys::RunSignalHandlers() (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3f7b6b8)
 #2 0x0000000003f7b83c SignalHandler(int) Signals.cpp:0:0
 #3 0x00004000249907a0 (linux-vdso.so.1+0x7a0)
 #4 0x0000000007207ba4 llvm::CodeExtractor::findAllocas(llvm::CodeExtractorAnalysisCache const&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&, llvm::BasicBlock*&) const (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x7207ba4)
 #5 0x0000000006e341a0 llvm::OpenMPIRBuilder::createParallel(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::IRBuilderBase::InsertPoint, llvm::function_ref<void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::IRBuilderBase::InsertPoint (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::Value&, llvm::Value&, llvm::Value*&)>, std::function<void (llvm::IRBuilderBase::InsertPoint)>, llvm::Value*, llvm::Value*, llvm::omp::ProcBindKind, bool) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x6e341a0)
 #6 0x00000000055b2e2c (anonymous namespace)::OpenMPDialectLLVMIRTranslationInterface::convertOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) const OpenMPToLLVMIRTranslation.cpp:0:0
 #7 0x0000000005c65114 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x5c65114)
 #8 0x0000000005c70844 mlir::LLVM::ModuleTranslation::convertBlock(mlir::Block&, bool, llvm::IRBuilderBase&) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x5c70844)
 #9 0x0000000005c71438 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x5c71438)
#10 0x0000000005c71a58 mlir::LLVM::ModuleTranslation::convertFunctions() (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x5c71a58)
#11 0x0000000005c72864 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x5c72864)
#12 0x00000000045b6b48 Fortran::frontend::CodeGenAction::generateLLVMIR() (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x45b6b48)
#13 0x00000000045b86c8 Fortran::frontend::CodeGenAction::executeAction() (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x45b86c8)
#14 0x0000000003fae89c Fortran::frontend::FrontendAction::execute() (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3fae89c)
#15 0x0000000003fa25f4 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3fa25f4)
#16 0x0000000003fb3534 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3fb3534)
#17 0x0000000003bea120 fc1_main(llvm::ArrayRef<char const*>, char const*) (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3bea120)
#18 0x0000000003b75674 main (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3b75674)
#19 0x0000400024d74384 __libc_start_main (/lib64/libc.so.6+0x24384)
#20 0x0000000003be8f54 _start (/lustre/home/ohno/LLVM_20231130/release/bin/flang-new+0x3be8f54)
flang-new: error: unable to execute command: Segmentation fault (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git 770dc47659d41a5ca7b7daf5b3134c900ca8c33d)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /lustre/home/ohno/LLVM_20231130/release/bin
flang-new: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/omp_PL_ATOMIC_001c_3-39f821
flang-new: note: diagnostic msg: /tmp/omp_PL_ATOMIC_001c_3-39f821.sh
flang-new: note: diagnostic msg:

********************
$
$ cat /tmp/omp_PL_ATOMIC_001c_3-39f821
#line "./omp_PL_ATOMIC_001c_3.f90" 1
      program main
      complex*8 ia, ib
      integer*4 :: loop=10000
      ia = (0,0)
!$omp parallel
!$omp do
      do i=1, loop
!$omp atomic
         ia = ia + (1,1)
      enddo
!$omp end do
!$omp end parallel
      end
$
$ cat /tmp/omp_PL_ATOMIC_001c_3-39f821.sh
# Crash reproducer for clang version 18.0.0 (https://github.com/llvm/llvm-project.git 770dc47659d41a5ca7b7daf5b3134c900ca8c33d)
# Driver args: "-fopenmp" "omp_PL_ATOMIC_001c_3.f90"
# Original command:  "/lustre/home/ohno/LLVM_20231130/release/bin/flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-fopenmp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8a" "-o" "/tmp/omp_PL_ATOMIC_001c_3-814ed2.o" "-x" "f95-cpp-input" "omp_PL_ATOMIC_001c_3.f90"
 "/lustre/home/ohno/LLVM_20231130/release/bin/flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-fopenmp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8a" "-x" "f95-cpp-input" "omp_PL_ATOMIC_001c_3-39f821"
$
$ gfortran -fopenmp omp_PL_ATOMIC_001c_3.f90
$
$ ifort -qopenmp omp_PL_ATOMIC_001c_3.f90
$

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions