clang 18.1 parser crash (original) (raw)
Godbolt link: https://godbolt.org/z/obG6EThzd
clang trunk W/ assertions: https://godbolt.org/z/aWKnWh5co
Produces following output:
Assertion:
clang++: /root/llvm-project/clang/include/clang/AST/Type.h:956: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
Backtrace:
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 -std=c++20 1. :1:29: current parser token ')' 2. :1:10: lambda expression parsing #0 0x000000000397dfb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x397dfb8) #1 0x000000000397bc9c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x397bc9c) #2 0x00000000038ccd48 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #3 0x00007989c6a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x00007989c6a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #5 0x00007989c6a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x00007989c6a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x00007989c6a2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x00007989c6a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x000000000747c033 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x747c033) #10 0x0000000007482c64 clang::FunctionDecl::getNumParams() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7482c64) #11 0x0000000007482ed9 clang::FunctionDecl::hasCXXExplicitFunctionObjectParameter() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7482ed9) #12 0x000000000694720e clang::Sema::CheckCXXThisType(clang::SourceLocation, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x694720e) #13 0x0000000006948bc1 clang::Sema::ActOnCXXThis(clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6948bc1) #14 0x00000000063007ee clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63007ee) #15 0x00000000063031aa clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63031aa) #16 0x0000000006303349 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6303349) #17 0x0000000006307cb9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6307cb9) #18 0x00000000062e4e9b clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62e4e9b) #19 0x000000000631b6cf clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtrclang::QualType, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x631b6cf) #20 0x000000000628bc93 clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x628bc93) #21 0x00000000062d28c0 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62d28c0) #22 0x00000000062d3c21 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62d3c21) #23 0x00000000062daaf0 clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62daaf0) #24 0x0000000006322db8 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6322db8) #25 0x000000000632313b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x632313b) #26 0x0000000006301715 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6301715) #27 0x00000000063031aa clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63031aa) #28 0x0000000006303349 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6303349) #29 0x0000000006307cb9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6307cb9) #30 0x00000000062e4e9b clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62e4e9b) #31 0x000000000631b6cf clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtrclang::QualType, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x631b6cf) #32 0x000000000628bc93 clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x628bc93) #33 0x00000000062d28c0 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62d28c0) #34 0x000000000628c257 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x628c257) #35 0x000000000628cc53 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x628cc53) #36 0x0000000006293257 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6293257) #37 0x000000000629410f clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x629410f) #38 0x00000000062945d0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62945d0) #39 0x0000000006287b9c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6287b9c) #40 0x0000000004249738 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4249738) #41 0x00000000044cc3c9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44cc3c9) #42 0x0000000004453cee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4453cee) #43 0x00000000045b2f2e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45b2f2e) #44 0x0000000000c50a6c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc50a6c) #45 0x0000000000c49dca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0 #46 0x000000000428d239 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optionalllvm::StringRef>, std::__cxx11::basic_string<char, std::char_traits, std::allocator>, bool) const::'lambda'()>(long) Job.cpp:0:0 #47 0x00000000038cd1f4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38cd1f4) #48 0x000000000428d82f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optionalllvm::StringRef>, std::__cxx11::basic_string<char, std::char_traits, std::allocator>, bool) const (.part.0) Job.cpp:0:0 #49 0x0000000004253925 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4253925) #50 0x000000000425438d 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+++0x425438d) #51 0x000000000425c085 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x425c085) #52 0x0000000000c4df75 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4df75) #53 0x0000000000b2fc04 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb2fc04) #54 0x00007989c6a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #55 0x00007989c6a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #56 0x0000000000c4987e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4987e) clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation) Compiler returned: 134