<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63520>63520</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `clangtk`: Assertion `Block == Succ' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wierton
      </td>
    </tr>
</table>

<pre>
    When compiling below program using `clangtk`, `clangtk` triggers assertion failure.
```
void f(int a) {
  for (;; ({
         if (a) { a; continue; }
       }))
 ;
}
```

The output of `clangtk` (verification link https://gcc.godbolt.org/z/qnc6zdb3b):
```
clang: /root/llvm-project/clang/lib/Analysis/CFG.cpp:3550: 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 -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics <source>
1.      <eof> parser at end of file
2.      <source>:1:15: parsing function body 'f'
 #0 0x00005555c5f5a93f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c5293f)
 #1 0x00005555c5f586ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c506ac)
 #2 0x00005555c5ea2d98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007efceec7d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007efcee74a00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007efcee729859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007efcee729729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007efcee73afd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00005555c944f186 (anonymous namespace)::CFGBuilder::VisitForStmt(clang::ForStmt*) CFG.cpp:0:0
 #9 0x00005555c945241d (anonymous namespace)::CFGBuilder::VisitCompoundStmt(clang::CompoundStmt*, bool) CFG.cpp:0:0
#10 0x00005555c945433c (anonymous namespace)::CFGBuilder::buildCFG(clang::Decl const*, clang::Stmt*) CFG.cpp:0:0
#11 0x00005555c9455a85 clang::CFG::buildCFG(clang::Decl const*, clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x714da85)
#12 0x00005555c93f9cc0 clang::AnalysisDeclContext::getCFG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x70f1cc0)
#13 0x00005555c93554c9 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x704d4c9)
#14 0x00005555c883abc6 clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6532bc6)
#15 0x00005555c8a3c87c clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x673487c)
#16 0x00005555c87b23ed clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x64aa3ed)
#17 0x00005555c86dd2b1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63d52b1)
#18 0x00005555c87041c0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63fc1c0)
#19 0x00005555c86d0b51 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c8b51)
#20 0x00005555c86d140f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#21 0x00005555c86d7db1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63cfdb1)
#22 0x00005555c86d8726 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63d0726)
#23 0x00005555c86d8bc4 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63d0bc4)
#24 0x00005555c86cc49a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c449a)
#25 0x00005555c71d0ec8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ec8ec8)
#26 0x00005555c6a1b799 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4713799)
#27 0x00005555c69a10e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x46990e6)
#28 0x00005555c6affeb6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f7eb6)
#29 0x00005555c33fe02d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f602d)
#30 0x00005555c33f9d2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x00005555c68017ed 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
#32 0x00005555c5ea32a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b9b2a0)
#33 0x00005555c6801e0f 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
#34 0x00005555c67c8f7c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c0f7c)
#35 0x00005555c67c9a0d 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+0x44c1a0d)
#36 0x00005555c67d1aed clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c9aed)
#37 0x00005555c33fc28a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f428a)
#38 0x00005555c33025a5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xffa5a5)
#39 0x00007efcee72b083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#40 0x00005555c33f4b0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10ecb0e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z46jS_jXkhrILgT4vcuE443mzNW9NziS1e-lCgGxOZNACyiT760-BZMcoTiaz692qU2cqnrL5aJ5-uulukKi1cqOEuATZFciuL2jvttpcfpfCOK0uas2fL3_bCgWZ3nWylWoDa9Hq77AzemPoDvbWt4EcsZaqjXsAOQJ4GTdAZ-RmI4yF1FphnNQKNlS2vRFzgK4BWvhZw1_4-aglhw3ApVQOUoArCIqroQvCRhsIcAnIFSBX4dtL3_hPNr59PxFSP5Bp5aTqRZhUXEcz_G9c-b-h1csecO0HTgAO_99vBdS963oHdTNRGeDyURjZSEaDvq1UD3DrXGcBWQC8Ani1YWy-0bzWrZtrswF49QfAq98Vy__gNak9HLI4uXxYB5AFBHhltHYAr9r2cTfrjP63YP7nMAKvWlkDvFoo2j5baQFeLVef56zrAFmQLENexl4YIIvl6vNVq9kDwAtPHFVaPe90bz0NhwG9bLkww-9fpZVupc2d2zmAyyNRh8bFoAdcHEwPchRWgYBcA3IN73rGAC6CSwg-esTtl0-Lu0_Q9vVOOkhh3W-gEZ02Djo9JVK6bV_Pmd6NRLzmQ1rbC68_pIpDqVjbcwHdVkBmqN3CmrIHZygT3nk7IzqjmbBWcGh1b4ZmP5Naq5mkTnBoegUtM7JzI-Q7R9kD5P2uO9gNzQGqbsetQs2m3wnl7Gg53QVLhY0lzEw8da02wuytNztsFjtzplcPAK9qqfbdcLbh36lpZimcbeBMe4m067zc4JJzC2d3cDbbMDZzWrdsS6XyjL-3sB9czfEc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