<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91058>91058</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash at `CGDebugInfo.cpp:671: Unexpected builtin type`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
clang:codegen,
debuginfo,
confirmed,
crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Endilll
</td>
</tr>
</table>
<pre>
While reducing #91006, I found the following crash (https://godbolt.org/z/q9cMs7Eez):
```
struct integral_constant {
constexpr operator int() {
return 0;
}
};
template < typename _Tp, _Tp... >
struct integer_sequence {};
int main() {
[]< int... i >(integer_sequence<int, i... >) {
(
[](auto k, integer_sequence<int>) {
using lambda_type = decltype([] -> decltype(k) { return {}; });
lambda_type a; // the only difference from #91006
}(integral_constant{}, __make_integer_seq<integer_sequence, int, i >{}),
...
);
}(integer_sequence<int, 0 >{});
}
```
```
Unexpected builtin type
UNREACHABLE executed at /root/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp:671!
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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:13:7: Generating code for declaration 'main()::(anonymous class)::operator()(integer_sequence<int, 0>)::(anonymous class)::operator()'
#0 0x0000000003979e88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3979e88)
#1 0x0000000003977b6c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3977b6c)
#2 0x00000000038c9528 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000078b0a9842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000078b0a98969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000078b0a9842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000078b0a98287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00000000038d47ba (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38d47ba)
#8 0x0000000003c5b672 clang::CodeGen::CGDebugInfo::CreateType(clang::BuiltinType const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5b672)
#9 0x0000000003c4d782 clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d782)
#10 0x0000000003c4d900 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d900)
#11 0x0000000003c5ab67 clang::CodeGen::CGDebugInfo::CreateType(clang::FunctionType const*, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5ab67)
#12 0x0000000003c4d66c clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d66c)
#13 0x0000000003c4d900 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d900)
#14 0x0000000003c5698a clang::CodeGen::CGDebugInfo::getOrCreateInstanceMethodType(clang::QualType, clang::FunctionProtoType const*, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5698a)
#15 0x0000000003c5f455 clang::CodeGen::CGDebugInfo::CreateCXXMemberFunction(clang::CXXMethodDecl const*, llvm::DIFile*, llvm::DIType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5f455)
#16 0x0000000003c5fd29 clang::CodeGen::CGDebugInfo::CollectCXXMemberFunctions(clang::CXXRecordDecl const*, llvm::DIFile*, llvm::SmallVectorImpl<llvm::Metadata*>&, llvm::DIType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5fd29)
#17 0x0000000003c5dff2 clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5dff2)
#18 0x0000000003c6070b clang::CodeGen::CGDebugInfo::CreateType(clang::RecordType const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c6070b)
#19 0x0000000003c4d681 clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d681)
#20 0x0000000003c4d900 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d900)
#21 0x0000000003c66bdb clang::CodeGen::CGDebugInfo::CreateType(clang::TypedefType const*, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c66bdb)
#22 0x0000000003c4d68f clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d68f)
#23 0x0000000003c4d900 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c4d900)
#24 0x0000000003c5096c clang::CodeGen::CGDebugInfo::EmitDeclare(clang::VarDecl const*, llvm::Value*, std::optional<unsigned int>, clang::CodeGen::CGBuilderTy&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5096c)
#25 0x00000000040891ad clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40891ad)
#26 0x000000000408a48b clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#27 0x000000000408a6e6 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x408a6e6)
#28 0x0000000003caac87 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3caac87)
#29 0x0000000003cc0289 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3cc0289)
#30 0x0000000003cb8205 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3cb8205)
#31 0x0000000003cbfcec clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3cbfcec)
#32 0x0000000003d229da clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d229da)
#33 0x0000000003d365bc clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d365bc)
#34 0x0000000003d96602 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d96602)
#35 0x0000000003d90eb5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d90eb5)
#36 0x0000000003d9cfcd clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d9cfcd)
#37 0x0000000003d9cf20 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d9cf20)
#38 0x0000000003d9f873 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d9f873)
#39 0x00000000042496fe (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#40 0x0000000004248215 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4248215)
#41 0x0000000006284e9c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6284e9c)
#42 0x0000000004247228 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4247228)
#43 0x00000000044c85b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c85b9)
#44 0x000000000445067e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x445067e)
#45 0x00000000045af39e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45af39e)
#46 0x0000000000c4fcec cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4fcec)
#47 0x0000000000c48f7a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#48 0x000000000428aa69 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
#49 0x00000000038c99d4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38c99d4)
#50 0x000000000428b05f 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
#51 0x00000000042513f5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42513f5)
#52 0x0000000004251e5d 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+++0x4251e5d)
#53 0x0000000004259be5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4259be5)
#54 0x0000000000c4d185 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4d185)
#55 0x0000000000b2f254 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb2f254)
#56 0x000078b0a9829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#57 0x000078b0a9829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#58 0x0000000000c48a6e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc48a6e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px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