Issue 164619
Summary [LifetimeSafety] Assertion failure with openmp
Labels crash-on-valid, clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
void explicit_maps_single() {
    int* pa;
#pragma omp target defaultmap(to : pointer)
    {
        pa[50]++;
 }
}
```
https://godbolt.org/z/c7Pjf7ex3

```
clang++: /root/llvm-project/llvm/tools/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp:338: void clang::lifetimes::internal::FactsGenerator::handleUse(const clang::DeclRefExpr*): Assertion `!UseFacts.contains(DRE)' 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++ -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 -Xclang -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -fopenmp <source>
1.	<eof> parser at end of file
2.	<source>:1:29: parsing function body 'explicit_maps_single'
 #0 0x00000000041f5e08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41f5e08)
 #1 0x00000000041f3234 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41f3234)
 #2 0x0000000004137498 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000795554642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007955546969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000795554642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007955546287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000079555462871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000795554639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000076806d2 clang::lifetimes::internal::FactsGenerator::handleUse(clang::DeclRefExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76806d2)
#10 0x0000000007680ea7 clang::lifetimes::internal::FactsGenerator::VisitDeclRefExpr(clang::DeclRefExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7680ea7)
#11 0x000000000768188f clang::lifetimes::internal::FactsGenerator::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x768188f)
#12 0x000000000766051d clang::lifetimes::internal::LifetimeSafetyAnalysis::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x766051d)
#13 0x0000000007660aeb clang::lifetimes::runLifetimeSafetyAnalysis(clang::AnalysisDeclContext&, clang::lifetimes::LifetimeSafetyReporter*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7660aeb)
#14 0x00000000075a243c clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75a243c)
#15 0x0000000006a7ca9a clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7ca9a)
#16 0x0000000006cdd9e4 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cdd9e4)
#17 0x00000000069f6dc4 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69f6dc4)
#18 0x00000000068fd7eb clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68fd7eb)
#19 0x0000000006933c5d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6933c5d)
#20 0x00000000068f0f8e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f0f8e)
#21 0x00000000068f172f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f172f)
#22 0x00000000068f8fe3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f8fe3)
#23 0x00000000068f9ef5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f9ef5)
#24 0x00000000068fa3b0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68fa3b0)
#25 0x00000000068db543 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68db543)
#26 0x0000000004b3e668 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b3e668)
#27 0x0000000004e2bcf5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e2bcf5)
#28 0x0000000004dacd8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dacd8e)
#29 0x0000000004f2377d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f2377d)
#30 0x0000000000dc3800 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdc3800)
#31 0x0000000000dba36a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#32 0x0000000000dba4ed 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
#33 0x0000000004ba7819 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
#34 0x0000000004137934 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4137934)
#35 0x0000000004ba7e2f 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
#36 0x0000000004b69142 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b69142)
#37 0x0000000004b6a0ee 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+++0x4b6a0ee)
#38 0x0000000004b71825 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b71825)
#39 0x0000000000dbfd29 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdbfd29)
#40 0x0000000000c6fab4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc6fab4)
#41 0x0000795554629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#42 0x0000795554629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#43 0x0000000000db9e05 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdb9e05)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to