Issue 131641
Summary `deferred extra vtables during vtable emission?` assertion fires
Labels c++20, clang:codegen, debuginfo, confirmed, crash
Assignees
Reporter Endilll
    While reducing #124673, the following crash has surfaced (https://godbolt.org/z/cEzoeGz5e):
```cpp
struct PrimitiveImplCodec {
 virtual void Write();
};

constexpr PrimitiveImplCodec DefaultedOf{};

template <auto>
struct Field {
  using FieldType = Field;
};

typename Field<DefaultedOf>::FieldType RecordOf();

template <auto>
struct InlineFieldCodec {
  virtual void WriteInline();
};

void GetPartCodec() {
  constexpr InlineFieldCodec<RecordOf> QuadCodec;
  // constexpr InlineFieldCodec<0> CubeCodec;
}
```
```
clang++: /root/llvm-project/clang/lib/CodeGen/CGVTables.cpp:1280:
void clang::CodeGen::CodeGenModule::EmitDeferredVTables():
Assertion `savedSize == DeferredVTables.size() && "deferred extra vtables during vtable emission?"' 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 -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -g0 -Xclang -debug-info-kind=constructor <source>
1.	<eof> parser at end of file
2.	Per-file LLVM IR generation
 #0 0x0000000003e836b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e836b8)
 #1 0x0000000003e81344 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e81344)
 #2 0x0000000003dc61d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007408c9e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007408c9e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007408c9e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007408c9e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007408c9e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007408c9e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000043b7313 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43b7313)
#10 0x00000000044457fb clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44457fb)
#11 0x0000000004447c33 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4447c33)
#12 0x000000000484225e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#13 0x000000000483e705 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x483e705)
#14 0x000000000649dd2c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x649dd2c)
#15 0x000000000483eeb8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x483eeb8)
#16 0x0000000004b0e995 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b0e995)
#17 0x0000000004a90ade clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a90ade)
#18 0x0000000004bfe6be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bfe6be)
#19 0x0000000000d4f70f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd4f70f)
#20 0x0000000000d46eca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000000004887419 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
#22 0x0000000003dc6674 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3dc6674)
#23 0x0000000004887a2f 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
#24 0x000000000484a49d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x484a49d)
#25 0x000000000484b52e 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+++0x484b52e)
#26 0x0000000004852c05 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4852c05)
#27 0x0000000000d4c508 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd4c508)
#28 0x0000000000c13de4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc13de4)
#29 0x00007408c9e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x00007408c9e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x0000000000d46975 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd46975)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to