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

    <tr>
        <th>Summary</th>
        <td>
            Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' 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>
    The code snippet below triggers an assertion failure when compiled with `clangtk` using the `-O0` option. This behavior can be verified at https://gcc.godbolt.org/z/dr67qnGhc.
```
enum E e;
void g(void) { int a[e][3]; }
```

Below is compiler's output copied from gcc.godbolt.org:
```
clang: /root/llvm-project/clang/include/clang/AST/Type.h:752: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1.      <eof> parser at end of file
2.      <source>:2:6: LLVM IR generation of declaration 'g'
3.      <source>:2:6: Generating code for declaration 'g'
 #0 0x000055a1ec85b1df llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bb41df)
 #1 0x000055a1ec858f4c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bb1f4c)
 #2 0x000055a1ec7a2658 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fc1d4cbe420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fc1d478b00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fc1d476a859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fc1d476a729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fc1d477bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055a1ecf1bffc hasBooleanRepresentation(clang::QualType) CGExpr.cpp:0:0
 #9 0x000055a1ecf1ef02 clang::CodeGen::CodeGenFunction::EmitFromMemory(llvm::Value*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4277f02)
#10 0x000055a1ecf31e79 clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(clang::CodeGen::Address, bool, clang::QualType, clang::SourceLocation, clang::CodeGen::LValueBaseInfo, clang::CodeGen::TBAAAccessInfo, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x428ae79)
#11 0x000055a1ecf3240e clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(clang::CodeGen::LValue, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x428b40e)
#12 0x000055a1ecf32c5a clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x428bc5a)
#13 0x000055a1ecf8fc35 (anonymous namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*) CGExprScalar.cpp:0:0
#14 0x000055a1ecf88cb1 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#15 0x000055a1ecf88f0b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#16 0x000055a1ecf8b80b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#17 0x000055a1ecf875f4 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#18 0x000055a1ecf8f4e4 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42e84e4)
#19 0x000055a1ecbfa7aa clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f537aa)
#20 0x000055a1ecefe7c0 clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42577c0)
#21 0x000055a1eceff653 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#22 0x000055a1eceff950 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4258950)
#23 0x000055a1ecb7cc47 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ed5c47)
#24 0x000055a1ecb9152f clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3eea52f)
#25 0x000055a1ecb8a139 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ee3139)
#26 0x000055a1ecb90de4 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ee9de4)
#27 0x000055a1ecbf0e2a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f49e2a)
#28 0x000055a1ecc04c3f clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f5dc3f)
#29 0x000055a1ecc68c39 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fc1c39)
#30 0x000055a1ecc63bc5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fbcbc5)
#31 0x000055a1ecc64798 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fbd798)
#32 0x000055a1ecc6d6a3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#33 0x000055a1edaa61b6 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#34 0x000055a1eda966e0 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4def6e0)
#35 0x000055a1eef9f184 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62f8184)
#36 0x000055a1edaa2f78 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4dfbf78)
#37 0x000055a1ed2fcea9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4655ea9)
#38 0x000055a1ed281e46 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45dae46)
#39 0x000055a1ed3dfd26 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4738d26)
#40 0x000055a1e9d20f5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1079f5c)
#41 0x000055a1e9d1cc7a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#42 0x000055a1ed0e8d7d 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
#43 0x000055a1ec7a2b60 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3afbb60)
#44 0x000055a1ed0e95ff 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
#45 0x000055a1ed0b0bfc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4409bfc)
#46 0x000055a1ed0b168d 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+0x440a68d)
#47 0x000055a1ed0b976d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x441276d)
#48 0x000055a1e9d1f1da clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10781da)
#49 0x000055a1e9c26215 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xf7f215)
#50 0x00007fc1d476c083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#51 0x000055a1e9d17a5e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1070a5e)
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/eJzkWt1y47ixfhr6BiUVCfD3wheybM-ZLc_OnLHPnEsVCDQkZkiAAUCPnadPgaRkgZa8tldObZKqSdYCm43-PvQfQFBjqrUEOA-SiyC5PKOd3Sh9_qsCbZU8KxV_PL_bAGKKAzKyaluwqIRa_UJWV-s1aIOoRNQY0LZSEgla1Z0G9GsDEjHVtFUNHP2q7AYFachqKtf2Z5CGqDOVXCO7ATc--xq6MdU6HXN0t6kMKmFD7yulEaMSlYDuQVeiAo6oRRtrWxOQRYCvA3y9Zmy-VrxUtZ0rvQ7w9T8CfM11mv1dftqweRBeBuEiSMPxX_8TZNegKwQBuRgG7lXF0TrAufsjwAUKsgtUSYtokFxAkFwGyQVx_yEXKMguDyod_v-i56cyW_w6wJlBqrNtZxFTrQMhtGrQ1HCyOKi1Zy0gCxTga62UDfB1Xd83s1arvwFzPwcJfF1JVncc9kYWt3cBvr57bGG-CcgiS7BTxJQ0Fm31BmRx9WD_t6O1cYJL1TRKXlADAV7sCzkJJzD8WoMdJL9ZHeDcMdardfoXO39wIHBUmd-7uh6lApwGOEUBxksqpbJIg9UV3AOi6Pf_u7lB9rEF1KpKWkcdDnDWuxXwcSW_3Vwtbq-Q6cqmsoiislsjDa3SFlk19Y3KbrpyzlQzsvacvMqYDkyArxGVHI0U9p7JNDUbVFL202rKIMBL1GpotWJgDHBkVKeHYfcmNUaxilrgSHcSGaar1o4m31rKfiLeNe1ukcN5EBbftFpr2iCq110D0ppxmVXbL-voPzN4aGulHRvDws52AWdmVnfyZ4Cvy0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