I'm using clangd in Fedora 42 WSL vscode. clangd often crashes in rather simple projects such as leetcode problems and CS homework. I use openSUSE TW as well, and clangd with the same version in openSUSE doesn't crash. So, I think it's a Fedora bug. $ clangd --version clangd version 20.1.3 (Fedora 20.1.3-1.fc42) Features: linux Platform: x86_64-unknown-linux-gnu; target=x86_64-redhat-linux-gnu PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. <eof> parser at end of file 1. /home/fanta/develop/cpp/main.cpp:3:31: parsing function body 'run' 2. /home/fanta/develop/cpp/main.cpp:3:31: in compound statement ('{}') #0 0x00007f411491514a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.20.1+0x22914a) #1 0x00007f41149120d4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.20.1+0x2260d4) #2 0x00007f41149158bb (/lib64/libLLVM.so.20.1+0x2298bb) #3 0x00007f4114182c30 __restore_rt (/lib64/libc.so.6+0x19c30) #4 0x00007f411f6084cd (/lib64/libclang-cpp.so.20.1+0x27424cd) #5 0x00007f411f608048 clang::serialization::StableHashForTemplateArguments(llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x2742048) #6 0x00007f411f4d2b8d clang::ASTReader::LoadExternalSpecializationsImpl(llvm::DenseMap<clang::Decl const*, clang::serialization::reader::LazySpecializationInfoLookupTable, llvm::DenseMapInfo<clang::Decl const*, void>, llvm::detail::DenseMapPair<clang::Decl const*, clang::serialization::reader::LazySpecializationInfoLookupTable>>&, clang::Decl const*, llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x260cb8d) #7 0x00007f411f4d3184 non-virtual thunk to clang::ASTReader::LoadExternalSpecializations(clang::Decl const*, llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x260d184) #8 0x00007f411d43b237 clang::FunctionTemplateDecl::findSpecialization(llvm::ArrayRef<clang::TemplateArgument>, void*&) (/lib64/libclang-cpp.so.20.1+0x575237) #9 0x00007f411e5c96a3 clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/lib64/libclang-cpp.so.20.1+0x17036a3) #10 0x00007f411e5d4aba clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) (/lib64/libclang-cpp.so.20.1+0x170eaba) #11 0x00007f411e48cf1e clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, bool, llvm::function_ref<bool ()>) (/lib64/libclang-cpp.so.20.1+0x15c6f1e) #12 0x00007f411e4902bf clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/lib64/libclang-cpp.so.20.1+0x15ca2bf) #13 0x00007f411e338100 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/lib64/libclang-cpp.so.20.1+0x1472100) #14 0x00007f411e34bf1b (/lib64/libclang-cpp.so.20.1+0x1485f1b) #15 0x00007f411e34bda4 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool) (/lib64/libclang-cpp.so.20.1+0x1485da4) #16 0x00007f411dde4156 clang::SemaCodeCompletion::ProduceCallSignatureHelp(clang::Expr*, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation) (/lib64/libclang-cpp.so.20.1+0xf1e156) #17 0x00007f411d1462de (/lib64/libclang-cpp.so.20.1+0x2802de) #18 0x00007f411d1316d7 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/lib64/libclang-cpp.so.20.1+0x26b6d7) #19 0x00007f411d142f4a clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::function_ref<void ()>, bool, bool, bool*) (/lib64/libclang-cpp.so.20.1+0x27cf4a) #20 0x00007f411d134195 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/lib64/libclang-cpp.so.20.1+0x26e195) #21 0x00007f411d136d5e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/lib64/libclang-cpp.so.20.1+0x270d5e) #22 0x00007f411d1322ff clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/lib64/libclang-cpp.so.20.1+0x26c2ff) #23 0x00007f411d1317f7 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/lib64/libclang-cpp.so.20.1+0x26b7f7) #24 0x00007f411d152d9f clang::Parser::ParseCXXCondition(clang::ActionResult<clang::Stmt*, true>*, clang::SourceLocation, clang::Sema::ConditionKind, bool, clang::Parser::ForRangeInfo*, bool) (/lib64/libclang-cpp.so.20.1+0x28cd9f) #25 0x00007f411d1b12e2 clang::Parser::ParseForStatement(clang::SourceLocation*) (/lib64/libclang-cpp.so.20.1+0x2eb2e2) #26 0x00007f411d1aabe6 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/lib64/libclang-cpp.so.20.1+0x2e4be6) #27 0x00007f411d1a8c60 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/lib64/libclang-cpp.so.20.1+0x2e2c60) #28 0x00007f411d1b490e clang::Parser::ParseCompoundStatementBody(bool) (/lib64/libclang-cpp.so.20.1+0x2ee90e) #29 0x00007f411d1b5eec clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/lib64/libclang-cpp.so.20.1+0x2efeec) #30 0x00007f411d1d45d1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/lib64/libclang-cpp.so.20.1+0x30e5d1) #31 0x00007f411d0f385d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/lib64/libclang-cpp.so.20.1+0x22d85d) #32 0x00007f411d1d3373 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/lib64/libclang-cpp.so.20.1+0x30d373) #33 0x00007f411d1d2b6d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/lib64/libclang-cpp.so.20.1+0x30cb6d) #34 0x00007f411d1d1aae clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib64/libclang-cpp.so.20.1+0x30baae) #35 0x00007f411d1cf9a6 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.20.1+0x3099a6) #36 0x00007f411d1cf301 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.20.1+0x309301) #37 0x00007f411d0d8dcc clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.20.1+0x212dcc) #38 0x00007f411f7dc42f clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.20.1+0x291642f) #39 0x00005615e3eaa96d (/usr/sbin/clangd+0x1be96d) #40 0x00005615e3eacdf8 (/usr/sbin/clangd+0x1c0df8) #41 0x00005615e3e9bdbf (/usr/sbin/clangd+0x1afdbf) #42 0x00005615e40a3e21 (/usr/sbin/clangd+0x3b7e21) #43 0x00005615e4212d65 (/usr/sbin/clangd+0x526d65) #44 0x00007f41141da1d4 start_thread (/lib64/libc.so.6+0x711d4) #45 0x00007f411425ccec __GI___clone3 (/lib64/libc.so.6+0xf3cec) Signalled during preamble action: CodeComplete Filename: main.cpp Directory: /home/fanta/develop/cpp Command Line: /usr/lib64/llvm20/bin/clang -resource-dir=/usr/lib64/llvm20/bin/../../../lib/clang/20 -- /home/fanta/develop/cpp/main.cpp [Error - 1:23:38 AM] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. Reproducible: Always Steps to Reproduce: 1. install clang-devel-20.1.3-1.fc42.x86_64 2. install clangd vscode extension 3. #include <algorithm> void run(int num_total_tasks) { int cnt{}; int x; for (int i = 0; i < std::min(x, num_total_tas - cnt); ++i) { } } When completing ln7 Col48, clangd will crash. Actual Results: crash Expected Results: doesn't crash
Can you save that reproducer to a file and run clangd --check=test.cpp --check-completion and see if that also breaks?
Yes, it crashes. $ clangd --check=main.cpp --check-completion I[15:51:20.095] clangd version 20.1.3 (Fedora 20.1.3-1.fc42) I[15:51:20.095] Features: linux I[15:51:20.095] PID: 853 I[15:51:20.095] Working directory: /home/fanta/develop/cpp I[15:51:20.095] argv[0]: clangd I[15:51:20.095] argv[1]: --check=main.cpp I[15:51:20.095] argv[2]: --check-completion I[15:51:20.095] Entering check mode (no LSP server) I[15:51:20.095] Testing on source file /home/fanta/develop/cpp/main.cpp I[15:51:20.095] Loading compilation database... I[15:51:20.099] Failed to find compilation database for /home/fanta/develop/cpp/main.cpp I[15:51:20.099] Generic fallback command is: [/home/fanta/develop/cpp] /usr/lib64/llvm20/bin/clang -resource-dir=/usr/lib64/llvm20/bin/../../../lib/clang/20 -- /home/fanta/develop/cpp/main.cpp I[15:51:20.099] Parsing command... I[15:51:20.100] internal (cc1) args are: -cc1 -triple x86_64-redhat-linux-gnu -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/fanta/develop/cpp -fcoverage-compilation-dir=/home/fanta/develop/cpp -resource-dir /usr/lib64/llvm20/bin/../../../lib/clang/20 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/backward -internal-isystem /usr/lib64/llvm20/bin/../../../lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/15/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /home/fanta/develop/cpp/main.cpp I[15:51:20.100] Building preamble... I[15:51:20.147] Built preamble of size 1728684 for file /home/fanta/develop/cpp/main.cpp version null in 0.05 seconds I[15:51:20.147] Indexing headers... I[15:51:20.165] Building AST... E[15:51:20.167] [undeclared_var_use] Line 7: use of undeclared identifier 'num_' I[15:51:20.167] Indexing AST... I[15:51:20.167] Building inlay hints I[15:51:20.167] Building semantic highlighting I[15:51:20.167] Testing features at each token (may be slow in large files) I[15:51:20.169] Code complete: sema context PreprocessorDirective, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.169] Code complete: 15 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 15 returned. I[15:51:20.170] Code complete: sema context PreprocessorDirective, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.171] Code complete: 4 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 4 returned. I[15:51:20.176] Code complete: sema context IncludedFile, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.176] Code complete: 555 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.178] Code complete: sema context IncludedFile, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.178] Code complete: 1 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 1 returned. I[15:51:20.179] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.181] Code complete: sema context TopLevel, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.181] Code complete: 1 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 1 returned. I[15:51:20.183] Code complete: sema context SymbolOrNewName, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.183] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.185] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type void I[15:51:20.185] Code complete: 77 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.187] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type void I[15:51:20.187] Code complete: 1 results from Sema, 11 from Index, 0 matched, 0 from identifiers, 12 returned. I[15:51:20.188] Code complete: sema context NewName, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.188] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.190] Code complete: sema context TypeQualifiers, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.190] Code complete: 3 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 3 returned. I[15:51:20.192] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.192] Code complete: 92 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.194] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.194] Code complete: 1 results from Sema, 11 from Index, 0 matched, 0 from identifiers, 12 returned. I[15:51:20.196] Code complete: sema context NewName, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.196] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.198] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type int I[15:51:20.198] Code complete: 82 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.199] Code complete: Ignoring sema code complete callback with Recovery context. I[15:51:20.199] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.201] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.201] Code complete: 93 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.203] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.203] Code complete: 1 results from Sema, 11 from Index, 0 matched, 0 from identifiers, 12 returned. I[15:51:20.204] Code complete: sema context NewName, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.205] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.207] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.207] Code complete: 94 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.208] Code complete: sema context Statement, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.208] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.210] Code complete: sema context ParenthesizedExpression, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.211] Code complete: 85 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.212] Code complete: sema context ParenthesizedExpression, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.212] Code complete: 1 results from Sema, 11 from Index, 0 matched, 0 from identifiers, 12 returned. I[15:51:20.214] Code complete: sema context NewName, query scopes [] (AnyScope=false), expected type <none> I[15:51:20.214] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.216] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type int I[15:51:20.216] Code complete: 83 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.217] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 from identifiers, 0 returned. I[15:51:20.219] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type _Bool I[15:51:20.219] Code complete: 86 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.221] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type _Bool I[15:51:20.221] Code complete: 2 results from Sema, 14 from Index, 0 matched, 0 from identifiers, 16 returned (incomplete). I[15:51:20.223] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type int I[15:51:20.223] Code complete: 84 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.225] Code complete: sema context Expression, query scopes [] (AnyScope=false), expected type int I[15:51:20.225] Code complete: 1 results from Sema, 1 from Index, 1 matched, 0 from identifiers, 1 returned. I[15:51:20.227] Code complete: sema context Symbol, query scopes [std::] (AnyScope=false), expected type <none> I[15:51:20.228] Multiple code complete callbacks (parser backtracked?). Dropping results from context Symbol, keeping results from Symbol. I[15:51:20.228] Code complete: 0 results from Sema, 100 from Index, 0 matched, 0 from identifiers, 100 returned (incomplete). I[15:51:20.230] Code complete: sema context Symbol, query scopes [std::] (AnyScope=false), expected type <none> I[15:51:20.230] Multiple code complete callbacks (parser backtracked?). Dropping results from context Symbol, keeping results from Symbol. I[15:51:20.230] Code complete: 0 results from Sema, 19 from Index, 0 matched, 0 from identifiers, 19 returned. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: clangd --check=main.cpp --check-completion 1. <eof> parser at end of file 2. /home/fanta/develop/cpp/main.cpp:3:31: parsing function body 'run' 3. /home/fanta/develop/cpp/main.cpp:3:31: in compound statement ('{}') #0 0x00007fdc8cc8114a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.20.1+0x22914a) #1 0x00007fdc8cc7e0d4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.20.1+0x2260d4) #2 0x00007fdc8cc818bb (/lib64/libLLVM.so.20.1+0x2298bb) #3 0x00007fdc8c4eec30 __restore_rt (/lib64/libc.so.6+0x19c30) #4 0x00007fdc979744cd (/lib64/libclang-cpp.so.20.1+0x27424cd) #5 0x00007fdc97974048 clang::serialization::StableHashForTemplateArguments(llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x2742048) #6 0x00007fdc9783eb8d clang::ASTReader::LoadExternalSpecializationsImpl(llvm::DenseMap<clang::Decl const*, clang::serialization::reader::LazySpecializationInfoLookupTable, llvm::DenseMapInfo<clang::Decl const*, void>, llvm::detail::DenseMapPair<clang::Decl const*, clang::serialization::reader::LazySpecializationInfoLookupTable>>&, clang::Decl const*, llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x260cb8d) #7 0x00007fdc9783f184 non-virtual thunk to clang::ASTReader::LoadExternalSpecializations(clang::Decl const*, llvm::ArrayRef<clang::TemplateArgument>) (/lib64/libclang-cpp.so.20.1+0x260d184) #8 0x00007fdc957a7237 clang::FunctionTemplateDecl::findSpecialization(llvm::ArrayRef<clang::TemplateArgument>, void*&) (/lib64/libclang-cpp.so.20.1+0x575237) #9 0x00007fdc969356a3 clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*, clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind) (/lib64/libclang-cpp.so.20.1+0x17036a3) #10 0x00007fdc96940aba clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) (/lib64/libclang-cpp.so.20.1+0x170eaba) #11 0x00007fdc967f8f1e clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, bool, llvm::function_ref<bool ()>) (/lib64/libclang-cpp.so.20.1+0x15c6f1e) #12 0x00007fdc967fc2bf clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/lib64/libclang-cpp.so.20.1+0x15ca2bf) #13 0x00007fdc966a4100 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/lib64/libclang-cpp.so.20.1+0x1472100) #14 0x00007fdc966b7f1b (/lib64/libclang-cpp.so.20.1+0x1485f1b) #15 0x00007fdc966b7da4 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool) (/lib64/libclang-cpp.so.20.1+0x1485da4) #16 0x00007fdc96150156 clang::SemaCodeCompletion::ProduceCallSignatureHelp(clang::Expr*, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation) (/lib64/libclang-cpp.so.20.1+0xf1e156) #17 0x00007fdc954b22de (/lib64/libclang-cpp.so.20.1+0x2802de) #18 0x00007fdc9549d6d7 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/lib64/libclang-cpp.so.20.1+0x26b6d7) #19 0x00007fdc954aef4a clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::function_ref<void ()>, bool, bool, bool*) (/lib64/libclang-cpp.so.20.1+0x27cf4a) #20 0x00007fdc954a0195 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/lib64/libclang-cpp.so.20.1+0x26e195) #21 0x00007fdc954a2d5e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/lib64/libclang-cpp.so.20.1+0x270d5e) #22 0x00007fdc9549e2ff clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/lib64/libclang-cpp.so.20.1+0x26c2ff) #23 0x00007fdc9549d7f7 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/lib64/libclang-cpp.so.20.1+0x26b7f7) #24 0x00007fdc954bed9f clang::Parser::ParseCXXCondition(clang::ActionResult<clang::Stmt*, true>*, clang::SourceLocation, clang::Sema::ConditionKind, bool, clang::Parser::ForRangeInfo*, bool) (/lib64/libclang-cpp.so.20.1+0x28cd9f) #25 0x00007fdc9551d2e2 clang::Parser::ParseForStatement(clang::SourceLocation*) (/lib64/libclang-cpp.so.20.1+0x2eb2e2) #26 0x00007fdc95516be6 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/lib64/libclang-cpp.so.20.1+0x2e4be6) #27 0x00007fdc95514c60 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/lib64/libclang-cpp.so.20.1+0x2e2c60) #28 0x00007fdc9552090e clang::Parser::ParseCompoundStatementBody(bool) (/lib64/libclang-cpp.so.20.1+0x2ee90e) #29 0x00007fdc95521eec clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/lib64/libclang-cpp.so.20.1+0x2efeec) #30 0x00007fdc955405d1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/lib64/libclang-cpp.so.20.1+0x30e5d1) #31 0x00007fdc9545f85d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/lib64/libclang-cpp.so.20.1+0x22d85d) #32 0x00007fdc9553f373 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/lib64/libclang-cpp.so.20.1+0x30d373) #33 0x00007fdc9553eb6d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/lib64/libclang-cpp.so.20.1+0x30cb6d) #34 0x00007fdc9553daae clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib64/libclang-cpp.so.20.1+0x30baae) #35 0x00007fdc9553b9a6 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.20.1+0x3099a6) #36 0x00007fdc9553b301 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.20.1+0x309301) #37 0x00007fdc95444dcc clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.20.1+0x212dcc) #38 0x00007fdc97b4842f clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.20.1+0x291642f) #39 0x0000560ecf09196d (/usr/lib64/llvm20/bin/clangd+0x1be96d) #40 0x0000560ecf093df8 (/usr/lib64/llvm20/bin/clangd+0x1c0df8) #41 0x0000560ecefb8f6c (/usr/lib64/llvm20/bin/clangd+0xe5f6c) #42 0x0000560ecefa9a12 (/usr/lib64/llvm20/bin/clangd+0xd6a12) #43 0x00007fdc8c4d85f5 __libc_start_call_main (/lib64/libc.so.6+0x35f5) #44 0x00007fdc8c4d86a8 __libc_start_main.5 (/lib64/libc.so.6+0x36a8) #45 0x0000560eceee63d5 (/usr/lib64/llvm20/bin/clangd+0x133d5) fish: Job 1, 'clangd --check=main.cpp --check…' terminated by signal SIGILL (Illegal instruction)
Thanks for confirming that. I've reduced the cast case and bisected the problem, see upstream issue https://github.com/llvm/llvm-project/issues/139019
*** Bug 2361829 has been marked as a duplicate of this bug. ***
I notice upstream has fixed this bug via https://github.com/llvm/llvm-project/pull/141890 Is it possible to backport this fix and release a new patch version? Because of this bug, I can hardly use clangd.
I was working in Visual Studio Code when clangd crashed. Working on Clang codebase. reporter: libreport-2.17.15 comment: I was working in Visual Studio Code when clangd crashed. Working on Clang codebase. kernel: 6.14.9-300.fc42.x86_64 cgroup: 0::/user.slice/user-1000.slice/user/app.slice/vte-spawn-d949515f-9b42-4ca3-94dc-f844802432b2.scope cmdline: /usr/bin/clangd --log=verbose --pretty --background-index --clang-tidy --compile-commands-dir=/home/erick/code/llvm-project/build/ --enable-config rootdir: / backtrace_rating: 4 uid: 1000 dso_list: /usr/lib64/llvm20/bin/clangd clang-tools-extra-20.1.5-1.fc42.x86_64 (Fedora Project) 1748723864 type: CCpp executable: /usr/lib64/llvm20/bin/clangd reason: clangd killed by SIGILL journald_cursor: s=f375833453674f6592bd9d2a05e8159a;i=15e313;b=f54a6fa66a074a4183eb12318e289bcc;m=8557ca25;t=636c226df7acd;x=67a7b2f3c9c3c7ff crash_function: (anonymous namespace)::TemplateArgumentHasher::AddTemplateArgument runlevel: N 5 package: clang-tools-extra-20.1.5-1.fc42
FEDORA-2025-9949d3adba (llvm-20.1.6-7.fc43) has been submitted as an update to Fedora 43. https://bodhi.fedoraproject.org/updates/FEDORA-2025-9949d3adba
FEDORA-2025-5b6adebec8 (llvm-20.1.6-8.fc43) has been submitted as an update to Fedora 43. https://bodhi.fedoraproject.org/updates/FEDORA-2025-5b6adebec8
FEDORA-2025-09651f4b34 (llvm-20.1.6-9.fc43) has been submitted as an update to Fedora 43. https://bodhi.fedoraproject.org/updates/FEDORA-2025-09651f4b34
FEDORA-2025-09651f4b34 (llvm-20.1.6-9.fc43) has been pushed to the Fedora 43 stable repository. If problem still persists, please make note of it in this bug report.
Working in VSCode with Clangd on clang codebase. reporter: libreport-2.17.15 comment: Working in VSCode with Clangd on clang codebase. kernel: 6.14.11-300.fc42.x86_64 cgroup: 0::/user.slice/user-1000.slice/user/app.slice/vte-spawn-594dbb2a-e3b4-4d07-93b3-472169f28dc8.scope cmdline: /usr/bin/clangd --background-index --clang-tidy --compile-commands-dir=/home/erick/code/llvm-project/build/ --enable-config --header-insertion=never --pch-storage=memory rootdir: / backtrace_rating: 4 uid: 1000 dso_list: /usr/lib64/llvm20/bin/clangd clang-tools-extra-20.1.6-1.fc42.x86_64 (Fedora Project) 1749249031 type: CCpp executable: /usr/lib64/llvm20/bin/clangd reason: clangd killed by SIGILL journald_cursor: s=f375833453674f6592bd9d2a05e8159a;i=1edfa8;b=2a62c35f321a4b5884d550d424b595ad;m=515f3ea83;t=637cb6315aafc;x=56a3b754ab249d70 crash_function: (anonymous namespace)::TemplateArgumentHasher::AddTemplateArgument runlevel: N 5 package: clang-tools-extra-20.1.6-1.fc42
I used clangd on the store.hpp source file in https://gitlab.sai.jku.at/f4ncgb/f4ncgb. This source file uses quite a lot of C++ features and Clangd crashes repeatedly. reporter: libreport-2.17.15 type: CCpp reason: clangd killed by SIGILL journald_cursor: s=56650890f0ea4722b50eb4bb15570ae2;i=17ab54;b=2cc1c51329e34b4f9eda23f97119be4c;m=577d5f5d;t=637fc9f893ae3;x=cdc6dafe2d839c4c executable: /usr/lib64/llvm20/bin/clangd cmdline: /usr/bin/clangd cgroup: 0::/user.slice/user-1000.slice/user/app.slice/app-gnome-emacs-5117.scope rootdir: / uid: 1000 kernel: 6.14.11-300.fc42.x86_64 package: clang-tools-extra-20.1.6-1.fc42 runlevel: N 5 dso_list: /usr/lib64/llvm20/bin/clangd clang-tools-extra-20.1.6-1.fc42.x86_64 (Fedora Project) 1749211223 backtrace_rating: 4 crash_function: (anonymous namespace)::TemplateArgumentHasher::AddTemplateArgument comment: I used clangd on the store.hpp source file in https://gitlab.sai.jku.at/f4ncgb/f4ncgb. This source file uses quite a lot of C++ features and Clangd crashes repeatedly.