| Issue |
242737
|
| Summary |
[OMPIRBuilder] Assertion `getParent() && "only basic blocks in functions have valid numbers"' failed.
|
| Labels |
crash,
llvm:openmpirbuilder
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
```cpp
int foo() {
void bar();
bar();
return 0;
}
void baz(int lin) {
#pragma omp simd linear(lin : foo())
for (int i = 0; i < 2; i++)
;
#pragma omp simd
for (int j = 0; j < 2; j++)
;
}
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/include/llvm/IR/BasicBlock.h:96: unsigned int llvm::BasicBlock::getNumber() const: Assertion `getParent() && "only basic blocks in functions have valid numbers"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fopenmp -fopenmp-enable-irbuilder <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:7:6: Generating code for declaration 'baz'
#0 0x0000000004f69b28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f69b28)
#1 0x0000000004f66d84 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f66d84)
#2 0x0000000004f673bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f673bc)
#3 0x0000000004ea0f08 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x0000750c0f245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x0000750c0f29ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x0000750c0f24527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x0000750c0f2288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x0000750c0f22881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x0000750c0f23b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x0000000003e0fa63 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e0fa63)
#11 0x0000000003e22222 llvm::LoopInfoBase<llvm::BasicBlock, llvm::Loop>::analyzeImpl(llvm::Function*, llvm::function_ref<llvm::DominatorTreeBase<llvm::BasicBlock, false> const& ()>, llvm::function_ref<llvm::Loop* (llvm::BasicBlock*)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e22222)
#12 0x0000000003e232b9 llvm::LoopAnalysis::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e232b9)
#13 0x000000000acf5303 llvm::OpenMPIRBuilder::applySimd(llvm::CanonicalLoopInfo*, llvm::MapVector<llvm::Value*, llvm::Value*, llvm::DenseMap<llvm::Value*, unsigned int, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, unsigned int>>, llvm::SmallVector<std::pair<llvm::Value*, llvm::Value*>, 0u>, 0u>, llvm::Value*, llvm::omp::OrderKind, llvm::ConstantInt*, llvm::ConstantInt*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xacf5303)
#14 0x000000000564930c emitOMPSimdDirective(clang::OMPLoopDirective const&, clang::CodeGen::CodeGenFunction&, clang::CodeGen::CodeGenModule&)::'lambda'(clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&)::operator()(clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&) const (.isra.0) CGStmtOpenMP.cpp:0:0
#15 0x000000000555f3f5 clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x555f3f5)
#16 0x000000000555f5c3 (anonymous namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&, clang::Stmt const*) CGOpenMPRuntime.cpp:0:0
#17 0x00000000055570f4 clang::CodeGen::CGOpenMPRuntime::emitInlinedDirective(clang::CodeGen::CodeGenFunction&, llvm::omp::Directive, clang::CodeGen::RegionCodeGenTy const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x55570f4)
#18 0x000000000564062e emitOMPSimdDirective(clang::OMPLoopDirective const&, clang::CodeGen::CodeGenFunction&, clang::CodeGen::CodeGenModule&) CGStmtOpenMP.cpp:0:0
#19 0x00000000055fd7fb clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x55fd7fb)
#20 0x0000000005668a66 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5668a66)
#21 0x000000000567b0bc clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x567b0bc)
#22 0x00000000056eb0fa clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x56eb0fa)
#23 0x00000000056e47c5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x56e47c5)
#24 0x00000000056f3f27 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x56f3f27)
#25 0x00000000056f7759 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x56f7759)
#26 0x0000000005a692ee (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#27 0x0000000005a65865 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a65865)
#28 0x00000000090379dc clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90379dc)
#29 0x0000000005a65fa8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a65fa8)
#30 0x0000000005d90cb8 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d90cb8)
#31 0x0000000005d1d42d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d1d42d)
#32 0x0000000005e67bd3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e67bd3)
#33 0x000000000171db38 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x171db38)
#34 0x0000000001714a3a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#35 0x0000000001714bc3 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#36 0x0000000005adf639 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#37 0x0000000004ea1304 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ea1304)
#38 0x0000000005ae01a5 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#39 0x0000000005a9cfc2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5a9cfc2)
#40 0x0000000005aa027c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5aa027c)
#41 0x0000000005aac775 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5aac775)
#42 0x000000000171a18a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x171a18a)
#43 0x00000000016a0b03 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x16a0b03)
#44 0x0000750c0f22a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#45 0x0000750c0f22a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#46 0x00000000017143e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x17143e5)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs