<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122061>122061</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wxie7
</td>
</tr>
</table>
<pre>
code
```c
int main(void) {
int a = 1;
( * ( ++ a , ( char ( * ) [ a ] ) 0 ) ) != 2
}
```
https://godbolt.org/z/aj8EdEj5n
look similar to https://github.com/llvm/llvm-project/issues/121869, but current one just crash on assertions trunk
generated by fuzzing
<details><summary><strong>Backtrace</strong></summary>
<p>
```
clang: /root/llvm-project/clang/include/clang/AST/Type.h:945: 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 -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -x c -std=c2x -c <source>
1. <source>:4:1: current parser token '}'
2. <source>:1:16: parsing function body 'main'
3. <source>:1:16: in compound statement ('{}')
#0 0x0000000003c8d758 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c8d758)
#1 0x0000000003c8b464 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c8b464)
#2 0x0000000003bd89a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000071e925242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000071e9252969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000071e925242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000071e9252287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000071e92522871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000071e925239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000077b21b9 (anonymous namespace)::LValue::addUnsizedArray((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::QualType) ExprConstant.cpp:0:0
#10 0x000000000782bc82 (anonymous namespace)::PointerExprEvaluator::VisitCastExpr(clang::CastExpr const*) ExprConstant.cpp:0:0
#11 0x00000000077df5ba clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::PointerExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#12 0x00000000077e14cb EvaluatePointer(clang::Expr const*, (anonymous namespace)::LValue&, (anonymous namespace)::EvalInfo&, bool) ExprConstant.cpp:0:0
#13 0x0000000007830ce3 (anonymous namespace)::IntExprEvaluator::VisitBinaryOperator(clang::BinaryOperator const*) ExprConstant.cpp:0:0
#14 0x00000000077dc405 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#15 0x00000000077ca326 Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#16 0x00000000077d2ddb EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#17 0x00000000077d451c clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x77d451c)
#18 0x0000000006868836 clang::Sema::CheckForIntOverflow(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6868836)
#19 0x0000000006899005 clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6899005)
#20 0x0000000006c3af1c clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6c3af1c)
#21 0x0000000006f54bae clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6f54bae)
#22 0x0000000006733904 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6733904)
#23 0x0000000006729bde clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6729bde)
#24 0x000000000672ab30 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x672ab30)
#25 0x000000000672b9f5 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x672b9f5)
#26 0x000000000672d1fa clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x672d1fa)
#27 0x000000000663f4c3 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x663f4c3)
#28 0x000000000667407d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x667407d)
#29 0x000000000663322e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x663322e)
#30 0x00000000066339e9 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66339e9)
#31 0x000000000663b193 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x663b193)
#32 0x000000000663c06d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x663c06d)
#33 0x000000000663c510 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x663c510)
#34 0x000000000662e493 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x662e493)
#35 0x000000000461f2b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x461f2b8)
#36 0x00000000048dbab9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48dbab9)
#37 0x000000000485e18e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x485e18e)
#38 0x00000000049c906e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49c906e)
#39 0x0000000000ceda5f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xceda5f)
#40 0x0000000000ce54fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#41 0x0000000004664e49 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
#42 0x0000000003bd8e54 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bd8e54)
#43 0x000000000466543f 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
#44 0x000000000462902d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x462902d)
#45 0x000000000462a0ae 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+0x462a0ae)
#46 0x0000000004631bd5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4631bd5)
#47 0x0000000000cea8a3 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcea8a3)
#48 0x0000000000bb6b84 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbb6b84)
#49 0x000071e925229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#50 0x000071e925229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#51 0x0000000000ce4fa5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce4fa5)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</p>
</details>
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWl1z46i2_TXkhXJKQt8PeVCceG6mcqdzOz3z6kIIOXQk0AWUdvrXnwJky5I_kkw7U-fU6eqUbQGbtRabzQaBlWIrTukViK5BdHOBO_0k5NWPNaPJRSHK1ysiSgq8HMSe-0-AlzOuYYMZByh9EawEKIMguQZeDqEpwhAEN9AHgXkEUAoByqH7vAbo2pSjuX1AnrCEQ40MgsgWRzf2l-ee2T_f2ETGYHKziwd4-ZPWrQJBDtACoMVKlIWo9aWQK4AWPwFa4O_pbXn7PeKmnZfXQjxDxRpWYwm1gJPmTD91xSURDUCLun7ZfMxaKb5TogFaMKU6qgBa-MhP48yQKToNSScl5RoKTuH3TmlIJFZPUHCIlaJSM8EV1LLjzw7HinIqsaYlLF5h1f38yfjKlYBgXlKNWa1AcAuCueqaBsvX_oeWgq9AcHuNybOWmFAQzAFabJ_3P4c21mDbfxtLR2ps2hjxF1IIvU_W1UALxkndlXTnSf74DaDFt9eWXj6BIM_CyBgighvqvV0Q5Ldr_X8drpWpOBdNI_g1VtQM-E4lU8NUcL9WVLuaD1oClBoHsGaN_XyjJTQMkM_UH11d97UAigGKIUBojjkXGkqqJaMvFGL4x5_391C_thS2gnFNJUAIoARWmNW0vARe_nB_mz_eQtUVDTNeXHQrKGkrpP41N4GYl7DXD-on2jtGsR0_NIetpK0UhCpFS6hEJ91j0xIrJQizjiI7DhWRrNUG76PG5BmWXdMaWF7uXQIve5BiJXEDsVx1DeVa9aMrWjuaomlZTeWMrttaSCOCG8_Z4KMz56NoUZgZ7orhbFX-wLKahXC2gjNhLOK2NXY73Xb6UsFZY_jD2WydxjOsmpl65RqvQXBj1K7hrOJi9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