| Issue |
243031
|
| Summary |
[clang] Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed, referencing non-existent member in nested lambda.
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Pedda1712
|
The following, when compiled with '--std=c++20':
```c++
void a() {
[] ()
requires requires { []<typename T>() {
T::b;
}.template operator()<int>(); };
}
```
results in a crash on trunk (https://godbolt.org/z/en1rsbrzE).
BT:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -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. <source>:5:34: current parser token ')'
2. <source>:1:10: parsing function body 'a'
3. <source>:1:10: in compound statement ('{}')
4. <source>:2:3: lambda _expression_ parsing
5. <source>:3:25: instantiating function definition 'a()::(lambda)::clang++: /root/llvm-project/llvm/tools/clang/include/clang/AST/TypeBase.h:954: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
#0 0x0000000004f6a568 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f6a568)
#1 0x0000000004f677c4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f677c4)
#2 0x0000000004f6793e SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000000004f679e8 SignalHandlerTerminate(int, siginfo_t*, void*) Signals.cpp:0:0
#4 0x000075c56c645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x000075c56c69ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x000075c56c64527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x000075c56c6288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x000075c56c62881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x000075c56c63b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x0000000005352b14 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5352b14)
#11 0x000000000a2c8a97 clang::NamedDecl::printNestedNameSpecifier(llvm::raw_ostream&, clang::PrintingPolicy const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c8a97)
#12 0x000000000a2c8d3f clang::NamedDecl::printQualifiedName(llvm::raw_ostream&, clang::PrintingPolicy const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c8d3f)
#13 0x000000000a2c9edd clang::FunctionDecl::getNameForDiagnostic(llvm::raw_ostream&, clang::PrintingPolicy const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c9edd)
#14 0x000000000a2b5733 clang::PrettyDeclStackTraceEntry::print(llvm::raw_ostream&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2b5733)
#15 0x0000000004ee17a7 PrintCurStackTrace(llvm::raw_ostream&) PrettyStackTrace.cpp:0:0
#16 0x0000000004f677c4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f677c4)
#17 0x0000000004f67dfc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f67dfc)
#18 0x0000000004ea1928 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#19 0x000075c56c645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#20 0x000075c56c69ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#21 0x000075c56c64527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#22 0x000075c56c6288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#23 0x000075c56c62881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#24 0x000075c56c63b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#25 0x0000000005352b14 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5352b14)
#26 0x000000000a2c8a97 clang::NamedDecl::printNestedNameSpecifier(llvm::raw_ostream&, clang::PrintingPolicy const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c8a97)
#27 0x000000000a2c8d3f clang::NamedDecl::printQualifiedName(llvm::raw_ostream&, clang::PrintingPolicy const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c8d3f)
#28 0x000000000a2c9edd clang::FunctionDecl::getNameForDiagnostic(llvm::raw_ostream&, clang::PrintingPolicy const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa2c9edd)
#29 0x000000000a0e3245 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long>>, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xa0e3245)
#30 0x000000000531a7fc clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x531a7fc)
#31 0x0000000005df84e6 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5df84e6)
#32 0x0000000005318450 clang::DiagnosticsEngine::Report(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5318450)
#33 0x0000000005318b65 clang::DiagnosticsEngine::ProcessDiag(clang::DiagnosticBuilder const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5318b65)
#34 0x0000000005318c45 clang::DiagnosticsEngine::EmitDiagnostic(clang::DiagnosticBuilder const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5318c45)
#35 0x00000000091ec08f void llvm::function_ref<void (clang::SourceLocation, clang::PartialDiagnostic)>::callback_fn<clang::Sema::getDefaultDiagFunc()::'lambda'(clang::SourceLocation, clang::PartialDiagnostic)>(long, clang::SourceLocation, clang::PartialDiagnostic) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x91ec08f)
#36 0x0000000009c025bc llvm::function_ref<void (clang::SourceLocation, clang::PartialDiagnostic)>::operator()(clang::SourceLocation, clang::PartialDiagnostic) const (.isra.0) SemaTemplateInstantiate.cpp:0:0
#37 0x0000000009c0903c clang::Sema::PrintInstantiationStack(llvm::function_ref<void (clang::SourceLocation, clang::PartialDiagnostic)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9c0903c)
#38 0x00000000092004b5 clang::Sema::EmitDiagnostic(unsigned int, clang::DiagnosticBuilder const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x92004b5)
#39 0x000000000928b3a2 clang::SemaBase::ImmediateDiagBuilder::~ImmediateDiagBuilder() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x928b3a2)
#40 0x00000000091e2288 clang::SemaBase::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x91e2288)
#41 0x0000000009c2d84b clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc, clang::QualType, clang::NamedDecl*) SemaTemplateInstantiate.cpp:0:0
#42 0x0000000009c48768 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDependentScopeDeclRefExpr(clang::DependentScopeDeclRefExpr*, bool, clang::TypeSourceInfo**) SemaTemplateInstantiate.cpp:0:0
#43 0x0000000009c19448 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#44 0x0000000009c15e37 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) SemaTemplateInstantiate.cpp:0:0
#45 0x0000000009c165b5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#46 0x0000000009c628f2 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9c628f2)
#47 0x0000000009d04c87 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9d04c87)
#48 0x000000000abd2cb1 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xabd2cb1)
#49 0x0000000009b4a9e6 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9b4a9e6)
#50 0x00000000095dd37b clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x95dd37b)
#51 0x00000000099ed0bc clang::Sema::BuildCallToMemberFunction(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x99ed0bc)
#52 0x0000000009628bba clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9628bba)
#53 0x000000000962e76f clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x962e76f)
#54 0x00000000090d48f3 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90d48f3)
#55 0x00000000090cd46a clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cd46a)
#56 0x00000000090cf717 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cf717)
#57 0x00000000090cf7a9 clang::Parser::ParseAssignmentExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cf7a9)
#58 0x00000000090d3ef9 clang::Parser::ParseExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90d3ef9)
#59 0x00000000090df637 clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90df637)
#60 0x00000000090ce232 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90ce232)
#61 0x00000000090cf717 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cf717)
#62 0x00000000090da24a clang::Parser::ParseConstraintLogicalAndExpression(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90da24a)
#63 0x00000000090da5a7 clang::Parser::ParseConstraintLogicalOrExpression(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90da5a7)
#64 0x00000000090ab664 clang::Parser::ParseTrailingRequiresClause(clang::Declarator&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90ab664)
#65 0x00000000090e9e39 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90e9e39)
#66 0x00000000090ea23b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90ea23b)
#67 0x00000000090cee15 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cee15)
#68 0x00000000090cf717 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cf717)
#69 0x00000000090cf7a9 clang::Parser::ParseAssignmentExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90cf7a9)
#70 0x00000000090d3ef9 clang::Parser::ParseExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x90d3ef9)
#71 0x0000000009164b08 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9164b08)
#72 0x000000000915c3bf clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x915c3bf)
#73 0x000000000915cd36 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x915cd36)
#74 0x000000000916530e clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x916530e)
#75 0x0000000009165afa clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x9165afa)
#76 0x000000000905b83e clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x905b83e)
#77 0x00000000090a7b16 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+++0x90a7b16)
#78 0x000000000904f40b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x904f40b)
#79 0x000000000904fc4f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x904fc4f)
#80 0x000000000905cb78 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x905cb78)
#81 0x000000000905da95 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, cla<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs