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

    <tr>
        <th>Summary</th>
        <td>
            Assertion failure in clang::CodeGen::CodeGenTypes::isPointerZeroInitializable(clang::QualType)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Assertions-enabled Clang crashes on this input:
```
typedef unsigned long uint64_t;
struct R {
  uint64_t args[3];
};
template <class... Ts>
void g(Ts... args) {
  R r{.args = {uint64_t(args)...}};
}
struct S {
  virtual void f() {
 g(0, nullptr);
  }
};
S s;
```
https://gcc.godbolt.org/z/MPTnM1961

```
clang++: /root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:853: bool clang::CodeGen::CodeGenTypes::isPointerZeroInitializable(clang::QualType): Assertion `(T->isAnyPointerType() || T->isBlockPointerType()) && "Invalid type"' 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 <source>
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      <source>:6:6: Generating code for declaration 'g'
 #0 0x0000000003ef3f78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ef3f78)
 #1 0x0000000003ef1c04 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ef1c04)
 #2 0x0000000003e36738 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007c1819042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007c18190969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007c1819042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007c18190287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007c181902871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007c1819039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000004502e2c clang::CodeGen::CodeGenTypes::isPointerZeroInitializable(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4502e2c)
#10 0x0000000004260b99 isSimpleZero(clang::Expr const*, clang::CodeGen::CodeGenFunction&) CGExprAgg.cpp:0:0
#11 0x000000000426324c GetNumNonZeroBytesInInit(clang::Expr const*, clang::CodeGen::CodeGenFunction&) CGExprAgg.cpp:0:0
#12 0x00000000042633f3 GetNumNonZeroBytesInInit(clang::Expr const*, clang::CodeGen::CodeGenFunction&) CGExprAgg.cpp:0:0
#13 0x0000000004263600 GetNumNonZeroBytesInInit(clang::Expr const*, clang::CodeGen::CodeGenFunction&) CGExprAgg.cpp:0:0
#14 0x000000000426dcf8 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x426dcf8)
#15 0x00000000047e4162 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47e4162)
#16 0x00000000047f0002 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47f0002)
#17 0x00000000047f0766 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#18 0x00000000047f0f67 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47f0f67)
#19 0x00000000043bc7bc clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43bc7bc)
#20 0x00000000043d25d2 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d25d2)
#21 0x00000000043ca085 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43ca085)
#22 0x00000000043d206c clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d206c)
#23 0x0000000004437f22 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4437f22)
#24 0x000000000444b2d5 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x444b2d5)
#25 0x00000000044b51fa clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44b51fa)
#26 0x00000000044aff94 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44aff94)
#27 0x00000000044bc317 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44bc317)
#28 0x00000000044bc238 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44bc238)
#29 0x00000000044be8a3 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44be8a3)
#30 0x000000000489523e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#31 0x00000000048916a5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48916a5)
#32 0x000000000655258c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x655258c)
#33 0x0000000004891e38 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4891e38)
#34 0x0000000004b84f85 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b84f85)
#35 0x0000000004b03d4e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b03d4e)
#36 0x0000000004c73e7e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c73e7e)
#37 0x0000000000d9f3af cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9f3af)
#38 0x0000000000d963ba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x00000000048f84f9 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
#40 0x0000000003e36bd4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e36bd4)
#41 0x00000000048f8b0f 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
#42 0x00000000048baf6d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48baf6d)
#43 0x00000000048bbffe 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+++0x48bbffe)
#44 0x00000000048c3e55 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48c3e55)
#45 0x0000000000d9c0f8 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9c0f8)
#46 0x0000000000c236a4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc236a4)
#47 0x00007c1819029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#48 0x00007c1819029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#49 0x0000000000d95e65 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd95e65)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWm9v4yr2_jT0DUrkgP_lRV-4aTu_Xs3c3-ykOyvtmwhj7LDFYAHuTe-nX4GdOHYzf1I1c3e1o6kUYz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