| Issue |
164620
|
| Summary |
[LifetimeSafety] Assertion failure when control flow in for-loop update _expression_
|
| Labels |
crash-on-valid,
clang:temporal-safety
|
| Assignees |
|
| Reporter |
usx95
|
Encountered while running clang tests with lifetime safety enabled by default:
```cpp
void pr8880_3(int first) {
for ( ; ; (void)({ if (first) { first = 0; continue; } 0; })) {}
}
```
https://godbolt.org/z/zPPsb3xPs
```
clang++: /root/llvm-project/llvm/tools/clang/lib/Analysis/CFG.cpp:3673: clang::CFGBlock* {anonymous}::CFGBuilder::VisitForStmt(clang::ForStmt*): Assertion `Block == Succ' 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 <source>
1. <eof> parser at end of file
2. <source>:1:26: parsing function body 'pr8880_3'
#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 0x00007b05e0e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007b05e0e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007b05e0e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007b05e0e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007b05e0e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007b05e0e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000076b48e4 (anonymous namespace)::CFGBuilder::VisitForStmt(clang::ForStmt*) CFG.cpp:0:0
#10 0x00000000076b7795 (anonymous namespace)::CFGBuilder::VisitCompoundStmt(clang::CompoundStmt*, bool) CFG.cpp:0:0
#11 0x00000000076b9d2c clang::CFG::buildCFG(clang::Decl const*, clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76b9d2c)
#12 0x00000000076844d2 clang::AnalysisDeclContext::getCFG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76844d2)
#13 0x00000000075a2405 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75a2405)
#14 0x0000000006a7ca9a clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7ca9a)
#15 0x0000000006cdd9e4 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cdd9e4)
#16 0x00000000069f6dc4 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69f6dc4)
#17 0x00000000068fd7eb clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68fd7eb)
#18 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)
#19 0x00000000068f0f8e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f0f8e)
#20 0x00000000068f172f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f172f)
#21 0x00000000068f8fe3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f8fe3)
#22 0x00000000068f9ef5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68f9ef5)
#23 0x00000000068fa3b0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68fa3b0)
#24 0x00000000068db543 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68db543)
#25 0x0000000004b3e668 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b3e668)
#26 0x0000000004e2bcf5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e2bcf5)
#27 0x0000000004dacd8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dacd8e)
#28 0x0000000004f2377d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f2377d)
#29 0x0000000000dc3800 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdc3800)
#30 0x0000000000dba36a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#31 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
#32 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
#33 0x0000000004137934 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4137934)
#34 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
#35 0x0000000004b69142 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b69142)
#36 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)
#37 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)
#38 0x0000000000dbfd29 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdbfd29)
#39 0x0000000000c6fab4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc6fab4)
#40 0x00007b05e0e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x00007b05e0e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 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