Closed
Description
codegen crash in Clang occurring when a depend object was initialized with omp_all_memory locator in the depobj directive.
Here is reduced test case :
#include <omp.h>
int main()
{ omp_depend_t obj;
#pragma omp depobj(obj) depend(inout: omp_all_memory)
}
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fopenmp -emit-llvm -S <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:3:5: Generating code for declaration 'main'
#0 0x000000000396eb08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x396eb08)
#1 0x000000000396cc54 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x396cc54)
#2 0x00000000038bd7f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000071cd32a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000000000410fbdf clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(llvm::Value*, clang::CodeGen::Address, bool, clang::QualType, clang::CodeGen::LValueBaseInfo, clang::CodeGen::TBAAAccessInfo, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x410fbdf)
#5 0x0000000003cbf073 clang::CodeGen::CodeGenFunction::EmitOMPDepobjDirective(clang::OMPDepobjDirective const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cbf073)
#6 0x0000000003ca991b clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ca991b)
#7 0x0000000003cb0b19 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cb0b19)
#8 0x0000000003d1880a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d1880a)
#9 0x0000000003d234c5 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d234c5)
#10 0x0000000003d80f1b clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d80f1b)
#11 0x0000000003d7c395 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d7c395)
#12 0x0000000003d87b71 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d87b71)
#13 0x0000000003d89b03 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d89b03)
#14 0x00000000042b6d3e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#15 0x00000000042b47b5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x42b47b5)
#16 0x00000000062afb6c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62afb6c)
#17 0x00000000042b5135 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x42b5135)
#18 0x000000000457de71 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x457de71)
#19 0x00000000044fdd3b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x44fdd3b)
#20 0x0000000004662293 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4662293)
#21 0x0000000000cebe0c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xcebe0c)
#22 0x0000000000ce486d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#23 0x00000000042fcf59 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
#24 0x00000000038bdc23 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38bdc23)
#25 0x00000000042fd179 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
#26 0x00000000042c4b1d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x42c4b1d)
#27 0x00000000042c5b1d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x42c5b1d)
#28 0x00000000042cf0cc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x42cf0cc)
#29 0x0000000000ce8b61 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xce8b61)
#30 0x0000000000bb9fc4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xbb9fc4)
#31 0x000071cd32a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#32 0x000071cd32a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#33 0x0000000000ce430e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xce430e)