Skip to content

[flang][OpenMP] llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:8095: OpenMPIRBuilder::InsertPointTy llvm::OpenMPIRBuilder::createAtomicWrite(const llvm::OpenMPIRBuilder::LocationDescription &, llvm::OpenMPIRBuilder::AtomicOpValue &, llvm::Value *, llvm::AtomicOrdering): Assertion `(XElemTy->isFloatingPointTy() || XElemTy->isIntegerTy() || XElemTy->isPointerTy()) && "OMP atomic write expected a scalar type"' failed. #115652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
k-arrows opened this issue Nov 10, 2024 · 2 comments · Fixed by #121055
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Comments

@k-arrows
Copy link

Reproducer:

real :: r1
complex :: c1
!$omp atomic write
c1 = r1
end

Stack dump:

 #0 0x00007f6aacc5f727 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
 #1 0x00007f6aacc5d2be llvm::sys::RunSignalHandlers() 
 #2 0x00007f6aacc5fdfa SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f6aac597520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f6aac5eb9fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f6aac5eb9fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007f6aac5eb9fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007f6aac597476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007f6aac57d7f3 abort ./stdlib/abort.c:81:7
 #9 0x00007f6aac57d71b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f6aac58ee96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007f6aa0b1259b llvm::OpenMPIRBuilder::createAtomicWrite(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::Value*, llvm::AtomicOrdering) 
#12 0x00007f6aa002f7f8 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#13 0x00007f6aa2a44b1c mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) 
#14 0x00007f6aa2a4515a mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) 
#15 0x00007f6aa2a49037 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) 
#16 0x00007f6aa2a4beed mlir::LLVM::ModuleTranslation::convertFunctions() 
#17 0x00007f6aa2a4e83c mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef, bool) 
#18 0x00007f6aad92632a Fortran::frontend::CodeGenAction::generateLLVMIR() 
#19 0x00007f6aad92a2e8 Fortran::frontend::CodeGenAction::executeAction() 
#20 0x00007f6aad91f0fc Fortran::frontend::FrontendAction::execute() 
#21 0x00007f6aad9052a2 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) 
#22 0x00007f6aada8f37c Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) 
#23 0x000055dc62ae335b fc1_main(llvm::ArrayRef<char const*>, char const*) 
#24 0x000055dc62ae194a main 
#25 0x00007f6aac57ed90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#26 0x00007f6aac57ee40 call_init ./csu/../csu/libc-start.c:128:20
#27 0x00007f6aac57ee40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#28 0x000055dc62ae1465 _start 
flang-20: error: unable to execute command: Aborted (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project.git 0ac4821b718dd14e80d3856efa532d52df6878bb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
@github-actions github-actions bot added the flang Flang issues not falling into any other category label Nov 10, 2024
@k-arrows k-arrows added crash Prefer [crash-on-valid] or [crash-on-invalid] flang:openmp and removed flang Flang issues not falling into any other category labels Nov 10, 2024
@k-arrows
Copy link
Author

I used assertion-enabled flang-new, and the above reproducer was reduced and modified from the following.
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gfortran.dg/gomp/omp_atomic2.f90

@llvmbot
Copy link
Member

llvmbot commented Nov 10, 2024

@llvm/issue-subscribers-flang-ir

Author: None (k-arrows)

Reproducer: ```f90 real :: r1 complex :: c1 !$omp atomic write c1 = r1 end ```

Stack dump:

 #<!-- -->0 0x00007f6aacc5f727 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) 
 #<!-- -->1 0x00007f6aacc5d2be llvm::sys::RunSignalHandlers() 
 #<!-- -->2 0x00007f6aacc5fdfa SignalHandler(int) Signals.cpp:0:0
 #<!-- -->3 0x00007f6aac597520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00007f6aac5eb9fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #<!-- -->5 0x00007f6aac5eb9fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #<!-- -->6 0x00007f6aac5eb9fc pthread_kill ./nptl/pthread_kill.c:89:10
 #<!-- -->7 0x00007f6aac597476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #<!-- -->8 0x00007f6aac57d7f3 abort ./stdlib/abort.c:81:7
 #<!-- -->9 0x00007f6aac57d71b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#<!-- -->10 0x00007f6aac58ee96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#<!-- -->11 0x00007f6aa0b1259b llvm::OpenMPIRBuilder::createAtomicWrite(llvm::OpenMPIRBuilder::LocationDescription const&amp;, llvm::OpenMPIRBuilder::AtomicOpValue&amp;, llvm::Value*, llvm::AtomicOrdering) 
#<!-- -->12 0x00007f6aa002f7f8 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&amp;, mlir::LLVM::ModuleTranslation&amp;) OpenMPToLLVMIRTranslation.cpp:0:0
#<!-- -->13 0x00007f6aa2a44b1c mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&amp;, llvm::IRBuilderBase&amp;, bool) 
#<!-- -->14 0x00007f6aa2a4515a mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&amp;, bool, llvm::IRBuilderBase&amp;, bool) 
#<!-- -->15 0x00007f6aa2a49037 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) 
#<!-- -->16 0x00007f6aa2a4beed mlir::LLVM::ModuleTranslation::convertFunctions() 
#<!-- -->17 0x00007f6aa2a4e83c mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&amp;, llvm::StringRef, bool) 
#<!-- -->18 0x00007f6aad92632a Fortran::frontend::CodeGenAction::generateLLVMIR() 
#<!-- -->19 0x00007f6aad92a2e8 Fortran::frontend::CodeGenAction::executeAction() 
#<!-- -->20 0x00007f6aad91f0fc Fortran::frontend::FrontendAction::execute() 
#<!-- -->21 0x00007f6aad9052a2 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&amp;) 
#<!-- -->22 0x00007f6aada8f37c Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) 
#<!-- -->23 0x000055dc62ae335b fc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*) 
#<!-- -->24 0x000055dc62ae194a main 
#<!-- -->25 0x00007f6aac57ed90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#<!-- -->26 0x00007f6aac57ee40 call_init ./csu/../csu/libc-start.c:128:20
#<!-- -->27 0x00007f6aac57ee40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#<!-- -->28 0x000055dc62ae1465 _start 
flang-20: error: unable to execute command: Aborted (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project.git 0ac4821b718dd14e80d3856efa532d52df6878bb)
Target: x86_64-unknown-linux-gnu
Thread model: posix

@EugeneZelenko EugeneZelenko added mlir:openmp llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp and removed flang:ir flang:openmp mlir:openmp labels Apr 29, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm#113479
Fixes llvm#115652
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm#113479
Fixes llvm#115652
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm#113479
Fixes llvm#115652
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this issue May 6, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm/llvm-project#113479
Fixes llvm/llvm-project#115652
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this issue May 7, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm#113479
Fixes llvm#115652
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this issue May 9, 2025
This PR adds functionality for `__atomic_store` libcall in AtomicInfo.
This allows for supporting complex types in `atomic write`.

Fixes llvm#113479
Fixes llvm#115652
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:openmpirbuilder Issues related to problems in the llvm-project/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants