Open
Description
Reproducer:
https://godbolt.org/z/vb3hrfKoo
int __seg_gs a;
int b;
void f (void)
{
#pragma omp target map(alloc: a) map(from: b)
{
a = 0;
}
}
The original reproducer of this issue is the following:
https://github.com/gcc-mirror/gcc/blob/master/libgomp/testsuite/libgomp.c/address-space-1.c
Backtrace:
clang++: /root/llvm-project/llvm/lib/IR/Instructions.cpp:754: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -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 <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:4:6: Generating code for declaration 'f'
#0 0x0000000003f99d48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f99d48)
#1 0x0000000003f979d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f979d4)
#2 0x0000000003edc608 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000755879242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007558792969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x0000755879242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007558792287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075587922871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x0000755879239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000389ca8d llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x389ca8d)
#10 0x00000000048490b8 clang::CodeGen::CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48490b8)
#11 0x00000000048494f7 clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48494f7)
#12 0x00000000043f2d5c clang::CodeGen::CGOpenMPRuntime::emitCall(clang::CodeGen::CodeGenFunction&, clang::SourceLocation, llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43f2d5c)
#13 0x00000000043f2f92 emitTargetCallFallback(clang::CodeGen::CGOpenMPRuntime*, llvm::Function*, clang::OMPExecutableDirective const&, llvm::SmallVectorImpl<llvm::Value*>&, bool, clang::CapturedStmt const&, bool, clang::CodeGen::CodeGenFunction&) (.part.0) CGOpenMPRuntime.cpp:0:0
#14 0x00000000043f3068 void clang::CodeGen::RegionCodeGenTy::CallbackFn<emitTargetCallElse(clang::CodeGen::CGOpenMPRuntime*, llvm::Function*, clang::OMPExecutableDirective const&, llvm::SmallVectorImpl<llvm::Value*>&, bool, clang::CapturedStmt const&, bool, clang::CodeGen::CodeGenFunction&)::'lambda'(clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&)>(long, clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&) CGOpenMPRuntime.cpp:0:0
#15 0x00000000043efe75 clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43efe75)
#16 0x00000000043efece (anonymous namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&, clang::Stmt const*) CGOpenMPRuntime.cpp:0:0
#17 0x00000000043e961f clang::CodeGen::CGOpenMPRuntime::emitInlinedDirective(clang::CodeGen::CodeGenFunction&, llvm::omp::Directive, clang::CodeGen::RegionCodeGenTy const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43e961f)
#18 0x00000000043e888a emitTargetCallElse(clang::CodeGen::CGOpenMPRuntime*, llvm::Function*, clang::OMPExecutableDirective const&, llvm::SmallVectorImpl<llvm::Value*>&, bool, clang::CapturedStmt const&, bool, clang::CodeGen::CodeGenFunction&) CGOpenMPRuntime.cpp:0:0
#19 0x00000000043e89db void clang::CodeGen::RegionCodeGenTy::CallbackFn<clang::CodeGen::CGOpenMPRuntime::emitTargetCall(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&, llvm::Function*, llvm::Value*, clang::Expr const*, llvm::PointerIntPair<clang::Expr const*, 2u, clang::OpenMPDeviceClauseModifier, llvm::PointerLikeTypeTraits<clang::Expr const*>, llvm::PointerIntPairInfo<clang::Expr const*, 2u, llvm::PointerLikeTypeTraits<clang::Expr const*>>>, llvm::function_ref<llvm::Value* (clang::CodeGen::CodeGenFunction&, clang::OMPLoopDirective const&)>)::'lambda1'(clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&)>(long, clang::CodeGen::CodeGenFunction&, clang::CodeGen::PrePostActionTy&) CGOpenMPRuntime.cpp:0:0
#20 0x00000000043efe75 clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43efe75)
#21 0x00000000043f8553 clang::CodeGen::CGOpenMPRuntime::emitTargetCall(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&, llvm::Function*, llvm::Value*, clang::Expr const*, llvm::PointerIntPair<clang::Expr const*, 2u, clang::OpenMPDeviceClauseModifier, llvm::PointerLikeTypeTraits<clang::Expr const*>, llvm::PointerIntPairInfo<clang::Expr const*, 2u, llvm::PointerLikeTypeTraits<clang::Expr const*>>>, llvm::function_ref<llvm::Value* (clang::CodeGen::CodeGenFunction&, clang::OMPLoopDirective const&)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43f8553)
#22 0x00000000044a3236 emitCommonOMPTargetDirective(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&, clang::CodeGen::RegionCodeGenTy const&) (.constprop.0) CGStmtOpenMP.cpp:0:0
#23 0x00000000044a3aa2 clang::CodeGen::CodeGenFunction::EmitOMPTargetDirective(clang::OMPTargetDirective const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44a3aa2)
#24 0x000000000447aa62 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x447aa62)
#25 0x00000000044823cc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44823cc)
#26 0x00000000044e8586 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44e8586)
#27 0x00000000044fba0b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44fba0b)
#28 0x00000000045659d5 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45659d5)
#29 0x0000000004560b44 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4560b44)
#30 0x000000000456d347 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456d347)
#31 0x000000000456f8d3 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456f8d3)
#32 0x000000000494840e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#33 0x0000000004944825 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4944825)
#34 0x000000000662d34c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x662d34c)
#35 0x0000000004944fd8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4944fd8)
#36 0x0000000004c3cea5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c3cea5)
#37 0x0000000004bbbb3e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bbbb3e)
#38 0x0000000004d30a49 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d30a49)
#39 0x0000000000dac29f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdac29f)
#40 0x0000000000da246a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#41 0x00000000049ac2c9 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
#42 0x0000000003edcaa4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3edcaa4)
#43 0x00000000049ac8df 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
#44 0x000000000496e6ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x496e6ad)
#45 0x000000000496f73e 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+++0x496f73e)
#46 0x0000000004977a25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4977a25)
#47 0x0000000000da8208 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda8208)
#48 0x0000000000c2df44 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc2df44)
#49 0x0000755879229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#50 0x0000755879229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#51 0x0000000000da1f15 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda1f15)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
Metadata
Metadata
Assignees
Labels
IR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.OpenMP related changes to ClangOpenMP related changes to ClangVerified by a second partyVerified by a second partyPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]