Skip to content

clangd crash while parsing range/v3/algorithm/nth_element.hpp #125167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pierzchalski opened this issue Jan 31, 2025 · 4 comments
Open

clangd crash while parsing range/v3/algorithm/nth_element.hpp #125167

pierzchalski opened this issue Jan 31, 2025 · 4 comments
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@pierzchalski
Copy link

Since it asked nicely:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	/**/range-v3/include/range/v3/algorithm/nth_element.hpp:117:44: current parser token ';'
1.	/**/range-v3/include/range/v3/algorithm/nth_element.hpp:47:1: parsing namespace 'ranges'
2.	/**/range-v3/include/range/v3/algorithm/nth_element.hpp:106:5 <Spelling=/**/range-v3/include/range/v3/detail/config.hpp:630:5>: parsing struct/union/class body 'ranges::nth_element_fn'
3.	/**/range-v3/include/range/v3/algorithm/nth_element.hpp:113:9: parsing function body 'ranges::nth_element_fn::operator()'
4.	/**/range-v3/include/range/v3/algorithm/nth_element.hpp:113:9: in compound statement ('{}')
 #0 0x00007f530591301c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/f582fg8k06z2xg8zlwnrn4g895szwzfp-llvm-19.1.6-lib/lib/libLLVM.so.19.1+0xfee01c)
 #1 0x00007f530591045b SignalHandler(int) (/nix/store/f582fg8k06z2xg8zlwnrn4g895szwzfp-llvm-19.1.6-lib/lib/libLLVM.so.19.1+0xfeb45b)
 #2 0x00007f53043d5a70 __restore_rt (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x40a70)
 #3 0x00007f530fec7c0a clang::Sema::DeclareAggregateDeductionGuideFromInitList(clang::TemplateDecl*, llvm::MutableArrayRef<clang::QualType>, clang::SourceLocation) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x2119c0a)
 #4 0x00007f530fae6347 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::'lambda'(bool)::operator()(bool) const::'lambda'(clang::InitListExpr*)::operator()(clang::InitListExpr*) const (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d38347)
 #5 0x00007f530fae6a75 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::'lambda'(bool)::operator()(bool) const (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d38a75)
 #6 0x00007f530fae729b clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d3929b)
 #7 0x00007f530f71940d clang::Sema::deduceVarTypeFromInitializer(clang::VarDecl*, clang::DeclarationName, clang::QualType, clang::TypeSourceInfo*, clang::SourceRange, bool, clang::Expr*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x196b40d)
 #8 0x00007f530f72e12d clang::Sema::DeduceVariableDeclarationType(clang::VarDecl*, bool, clang::Expr*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x198012d)
 #9 0x00007f530f75a73a clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x19ac73a)
#10 0x00007f530ea8f5d5 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xce15d5)
#11 0x00007f530eaa4d74 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcf6d74)
#12 0x00007f530eaa8db7 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfadb7)
#13 0x00007f530eaa92b3 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfb2b3)
#14 0x00007f530eb5b498 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdad498)
#15 0x00007f530eb5befa clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdadefa)
#16 0x00007f530eb5d1e9 clang::Parser::ParseCompoundStatementBody(bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdaf1e9)
#17 0x00007f530eb5dc6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdafc6a)
#18 0x00007f530ea728be clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc48be)
#19 0x00007f530ea7256d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc456d)
#20 0x00007f530eacd2ff clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd1f2ff)
#21 0x00007f530eacf896 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd21896)
#22 0x00007f530ea94246 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xce6246)
#23 0x00007f530eb8d9c1 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xddf9c1)
#24 0x00007f530eb8e98d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde098d)
#25 0x00007f530eb97b2d clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde9b2d)
#26 0x00007f530eac28d7 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd148d7)
#27 0x00007f530eac5f42 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd17f42)
#28 0x00007f530eaa9612 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfb612)
#29 0x00007f530eb97cf7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde9cf7)
#30 0x00007f530eb98c45 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdeac45)
#31 0x00007f530ea7069a clang::ParseAST(clang::Sema&, bool, bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc269a)
#32 0x00007f5310f8ade9 clang::FrontendAction::Execute() (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x31dcde9)
#33 0x00007f5310fd1a5f clang::PrecompiledPreamble::Build(clang::CompilerInvocation const&, llvm::MemoryBuffer const*, clang::PreambleBounds, clang::DiagnosticsEngine&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::shared_ptr<clang::PCHContainerOperations>, bool, llvm::StringRef, clang::PreambleCallbacks&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x3223a5f)
#34 0x000000000077c560 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x77c560)
#35 0x00000000007fefc7 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x7fefc7)
#36 0x00000000007ffcb9 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x7ffcb9)
#37 0x0000000000a38669 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0xa38669)
#38 0x00007f530442ba72 start_thread (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x96a72)
#39 0x00007f53044af23c __GI___clone3 (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x11a23c)
Signalled while building preamble

I've attached the offending headers, but I can't share the relevant *.cpp file.

Should I move this issue to another repository? If so, which?

@EugeneZelenko EugeneZelenko added clangd crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jan 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 31, 2025

@llvm/issue-subscribers-clangd

Author: Edward Pierzchalski (pierzchalski)

Since it asked nicely: ``` PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. /**/range-v3/include/range/v3/algorithm/nth_element.hpp:117:44: current parser token ';' 1. /**/range-v3/include/range/v3/algorithm/nth_element.hpp:47:1: parsing namespace 'ranges' 2. /**/range-v3/include/range/v3/algorithm/nth_element.hpp:106:5 <Spelling=/**/range-v3/include/range/v3/detail/config.hpp:630:5>: parsing struct/union/class body 'ranges::nth_element_fn' 3. /**/range-v3/include/range/v3/algorithm/nth_element.hpp:113:9: parsing function body 'ranges::nth_element_fn::operator()' 4. /**/range-v3/include/range/v3/algorithm/nth_element.hpp:113:9: in compound statement ('{}') #0 0x00007f530591301c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/f582fg8k06z2xg8zlwnrn4g895szwzfp-llvm-19.1.6-lib/lib/libLLVM.so.19.1+0xfee01c) #1 0x00007f530591045b SignalHandler(int) (/nix/store/f582fg8k06z2xg8zlwnrn4g895szwzfp-llvm-19.1.6-lib/lib/libLLVM.so.19.1+0xfeb45b) #2 0x00007f53043d5a70 __restore_rt (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x40a70) #3 0x00007f530fec7c0a clang::Sema::DeclareAggregateDeductionGuideFromInitList(clang::TemplateDecl*, llvm::MutableArrayRef<clang::QualType>, clang::SourceLocation) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x2119c0a) #4 0x00007f530fae6347 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::'lambda'(bool)::operator()(bool) const::'lambda'(clang::InitListExpr*)::operator()(clang::InitListExpr*) const (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d38347) #5 0x00007f530fae6a75 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::'lambda'(bool)::operator()(bool) const (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d38a75) #6 0x00007f530fae729b clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x1d3929b) #7 0x00007f530f71940d clang::Sema::deduceVarTypeFromInitializer(clang::VarDecl*, clang::DeclarationName, clang::QualType, clang::TypeSourceInfo*, clang::SourceRange, bool, clang::Expr*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x196b40d) #8 0x00007f530f72e12d clang::Sema::DeduceVariableDeclarationType(clang::VarDecl*, bool, clang::Expr*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x198012d) #9 0x00007f530f75a73a clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x19ac73a) #10 0x00007f530ea8f5d5 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xce15d5) #11 0x00007f530eaa4d74 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcf6d74) #12 0x00007f530eaa8db7 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfadb7) #13 0x00007f530eaa92b3 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfb2b3) #14 0x00007f530eb5b498 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdad498) #15 0x00007f530eb5befa clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdadefa) #16 0x00007f530eb5d1e9 clang::Parser::ParseCompoundStatementBody(bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdaf1e9) #17 0x00007f530eb5dc6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdafc6a) #18 0x00007f530ea728be clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc48be) #19 0x00007f530ea7256d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc456d) #20 0x00007f530eacd2ff clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd1f2ff) #21 0x00007f530eacf896 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd21896) #22 0x00007f530ea94246 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xce6246) #23 0x00007f530eb8d9c1 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xddf9c1) #24 0x00007f530eb8e98d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde098d) #25 0x00007f530eb97b2d clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde9b2d) #26 0x00007f530eac28d7 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd148d7) #27 0x00007f530eac5f42 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xd17f42) #28 0x00007f530eaa9612 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcfb612) #29 0x00007f530eb97cf7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xde9cf7) #30 0x00007f530eb98c45 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xdeac45) #31 0x00007f530ea7069a clang::ParseAST(clang::Sema&, bool, bool) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0xcc269a) #32 0x00007f5310f8ade9 clang::FrontendAction::Execute() (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x31dcde9) #33 0x00007f5310fd1a5f clang::PrecompiledPreamble::Build(clang::CompilerInvocation const&, llvm::MemoryBuffer const*, clang::PreambleBounds, clang::DiagnosticsEngine&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::shared_ptr<clang::PCHContainerOperations>, bool, llvm::StringRef, clang::PreambleCallbacks&) (/nix/store/ymbp8lmggn7qgb8lwrzyzxnbyz77x08r-clang-19.1.6-lib/lib/libclang-cpp.so.19.1+0x3223a5f) #34 0x000000000077c560 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x77c560) #35 0x00000000007fefc7 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x7fefc7) #36 0x00000000007ffcb9 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0x7ffcb9) #37 0x0000000000a38669 (/nix/store/dvyzfs452dhmz21rammxqs5wxbnl44j4-clang-tools-19.1.6/bin/clangd+0xa38669) #38 0x00007f530442ba72 start_thread (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x96a72) #39 0x00007f53044af23c __GI___clone3 (/nix/store/h7zcxabfxa7v5xdna45y2hplj31ncf8a-glibc-2.40-36/lib/libc.so.6+0x11a23c) Signalled while building preamble ``` I've attached the offending [headers](https://github.com/user-attachments/files/18613126/range.tar.gz), but I can't share the relevant *.cpp file.

Should I move this issue to another repository? If so, which?

@pierzchalski
Copy link
Author

Looks like there was a fix for something similar recently, if I can get a cutting-edge build of clangd out of Nix I'll give it a go.

@pierzchalski
Copy link
Author

pierzchalski commented Jan 31, 2025

And it looks like this fix for a similar problem (removing boost-use-ranges from clang-tidy) works for me too. does not work for me.

@HighCommander4
Copy link
Collaborator

Looks like there was a fix for something similar recently, if I can get a cutting-edge build of clangd out of Nix I'll give it a go.

Yeah, that looks pretty similar based on the stack trace. If you're able to test the behaviour with a pre-release build of clangd 20 or trunk, please do so and update the issue with your findings. (Not sure how applicable it is to Nix, but two places I am aware of for finding pre-release clangd builds are weekly snapshot releases at https://github.com/clangd/clangd/releases, and packages at https://apt.llvm.org/.)

And it looks like this fix for a similar problem (removing boost-use-ranges from clang-tidy) works for me too. does not work for me.

That's a different crash which was fixed in 19.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants