<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61746>61746</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang ICE: `isa` used on a null pointer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
langston-barrett
</td>
</tr>
</table>
<pre>
This bug was found with a fuzzer; please feel free to close if it's not helpful.
```c
union { char x[]; } r = {0};
```
[Godbolt](https://godbolt.org/z/hPfvz41nd)
```
clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::Expr; From = clang::Stmt]: Assertion `Val && "isa<> used on a null pointer"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -c -O0 <source>
1. <source>:1:28: current parser token ';'
#0 0x0000562510d6649f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x401f49f)
#1 0x0000562510d641dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x401d1dc)
#2 0x0000562510cb12f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f9c8f19c420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f9c8ec6900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f9c8ec48859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f9c8ec48729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f9c8ec59fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x00005625137567eb (anonymous namespace)::SelfReferenceChecker::CheckExpr(clang::Expr*) SemaDecl.cpp:0:0
#9 0x00005625137aaa8c clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a63a8c)
#10 0x000056251347128e clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672a28e)
#11 0x0000562513482818 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x673b818)
#12 0x000056251344aeb2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6703eb2)
#13 0x000056251344b76f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#14 0x00005625134521f9 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x670b1f9)
#15 0x0000562513452b4d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x670bb4d)
#16 0x0000562513453014 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x670c014)
#17 0x00005625134469ea clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ff9ea)
#18 0x0000562511f86268 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x523f268)
#19 0x00005625117eaf09 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4aa3f09)
#20 0x000056251176f436 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a28436)
#21 0x00005625118cebf7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b87bf7)
#22 0x000056250e2eb5f6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x15a45f6)
#23 0x000056250e2e741a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#24 0x00005625115d819d 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
#25 0x0000562510cb17e0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f6a7e0)
#26 0x00005625115d8a5f 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
#27 0x00005625115a029c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x485929c)
#28 0x00005625115a0d3d 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+++0x4859d3d)
#29 0x00005625115a89ed clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48619ed)
#30 0x000056250e2e9aa0 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x15a2aa0)
#31 0x000056250e1f54d5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x14ae4d5)
#32 0x00007f9c8ec4a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x000056250e2e212e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x159b12e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
I looked for duplicates and didn't find any: https://github.com/llvm/llvm-project/issues?q=is%3Aopen+is%3Aissue+label%3Aclang%3Afrontend+isa+null+pointer
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkml9v46oSwD8NfUGpbPDfhz6kaXNuj_ZqV9vqvEYYjxNuCfgA7qb76a_AThvStKfnqN2He6WuFAMeZn4MM2NYZq1YK4ALlF-i_OqMDW6jzYVkam2dVrOGGQPOnTW6fby42wiLm2GNfzCLOz2oFv8QboMZ7oafP8Egeol7CcwC7gAk7gwAdhpzqS1g0WHhECktVtrhDci-G-Q5Sq5QMkdFMv7x8XlQQiuMykvMN8zg3aidl4_KK2wwole-N0GlbzySMT3ml7_pttHS-TdJtXGut4jOEVkislyPXefarBFZ_kRkufnWPfzMUtUiUp8UyD0URC79H51jRJZGa4fIUsqH7aw3-j_A94-ILIXicmjhueF26Htt_IgFs06o9fkG0Xma1F6adcwJjhutJQ7j6RzRub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