<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64453>64453</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] [OpenMP] flang-new crashes (synchronization Example)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Consider the following example program:
https://github.com/OpenMP/Examples/blob/main/synchronization/sources/flush_nolist.1.f
Stack dump:
```console
#0 0x0000557428ac4c74 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
#1 0x0000557428ac52c4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fbf505b9520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000557429a214f4 mlir::omp::WsLoopOp::getODSOperandIndexAndLength(unsigned int)
#4 0x0000557429a2156d mlir::omp::WsLoopOp::getODSOperands(unsigned int)
#5 0x000055742986cc34 (anonymous namespace)::OpenMPDialectLLVMIRTranslationInterface::convertOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) const OpenMPToLLVMIRTranslation.cpp:0:0
#6 0x000055742a58f140 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&)
#7 0x000055742a58f430 mlir::LLVM::ModuleTranslation::convertBlock(mlir::Block&, bool, llvm::IRBuilderBase&)
#8 0x0000557429872909 convertOmpOpRegions(mlir::Region&, llvm::StringRef, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&, mlir::LogicalResult&, llvm::SmallVectorImpl<llvm::PHINode*>*) OpenMPToLLVMIRTranslation.cpp:0:0
#9 0x00005574298723dd void llvm::function_ref<void (llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint)>::callback_fn<convertOmpParallel(mlir::omp::ParallelOp, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::$_20>(long, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint) OpenMPToLLVMIRTranslation.cpp:0:0
#10 0x000055742ab6f812 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)
#11 0x000055742986cd6a (anonymous namespace)::OpenMPDialectLLVMIRTranslationInterface::convertOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) const OpenMPToLLVMIRTranslation.cpp:0:0
#12 0x000055742a58f140 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&)
#13 0x000055742a58f430 mlir::LLVM::ModuleTranslation::convertBlock(mlir::Block&, bool, llvm::IRBuilderBase&)
#14 0x000055742a59078f mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp)
#15 0x000055742a591a0e mlir::LLVM::ModuleTranslation::convertFunctions()
#16 0x000055742a592bea mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef)
#17 0x0000557428c13244 Fortran::frontend::CodeGenAction::generateLLVMIR()
#18 0x0000557428c147f8 Fortran::frontend::CodeGenAction::executeAction()
#19 0x0000557428ae6468 Fortran::frontend::FrontendAction::execute()
#20 0x0000557428ade315 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&)
#21 0x0000557428ae8c40 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*)
#22 0x0000557427b100b9 fc1_main(llvm::ArrayRef<char const*>, char const*)
#23 0x0000557427b0f0c3 main
#24 0x00007fbf505a0d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#25 0x00007fbf505a0e40 call_init ./csu/../csu/libc-start.c:128:20
#26 0x00007fbf505a0e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#27 0x0000557427b0e635 _start
flang-new: error: unable to execute command: Segmentation fault
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 34ffc30a90d7ee1c57a57d4bf3a548d7374f7f51)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWNtu47oV_RrmhYhBUfcHPzjJcU_QmSZIBtNHg6K2ZDU0KZBULv36gpQcXZJ6xoPT4gAHmItMba619uYSb8yYppYAaxRfofjmgnV2r_T66ZJprV7MRaHKt_W1kqYpQWO7B1wpIdRLI2sMr-zQCsCtVrVmBxRuELlBZLO3tjXuF90iuq0bu--KFVcHRLd3Lciv94huf-v7GkS3hVAFotsDaySiW_Mm-V4r2fyb2Ub5FtVp7iMr0Zn9TirRGLsKVlVP1__7aBl_wmV3aN91oIT0f7iSRgnoWzGiIcHklRBC4jiNaMZ4xNMIC_Hscwg35s30D_e6kdYjf9OMA6LZGKTZy04Zq4EdEE0QvcaNtIjmI0uwYIkpj_BjU0smfmeyFKARzfpOQ7NZ8dbpJ_7vOxAdgNKqqGISF3lMCUY0Q3QrGle71yzZJdGlaGT3elnLrn_BV0atEkSvyGtEY0pm4sKpuJzRIKoifBCN7rNTfR3DzT_NF6Xau-FXDfbu5vGuBc1keStLeN3I8gvI2u4RzTrpzVR-qES0JIuT8kwycwo_nuFnCedh5ArEpJJvB9UZLNkBTOvHMO_ReyveNEwAt1--fP96-_BNM2mE992ttKArF--DuZLPoK3X0tsyG-VPWjfOB6NHbh-uukaUoK-YgcElYz9H2j99VWUnYELvY3PsjGtxr_Sb-iDyc7ck02KwOKu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