| Issue |
245061
|
| Summary |
misc-static-initialization-cycle crashes when ClangTidy FastCheckFilter set to None
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
PysKa-Ratzinger
|
By attempting to create a minimal reproducible example, I was able to come up with this. The crash happens when opening "foo.hpp". The crash does not happen if "foo.hpp" does not include "foo.inl" at the end of the file. The crash also doesn't happen if this .clangd is not present.
```.clangd
Diagnostics:
ClangTidy:
FastCheckFilter: None
```
```.clang-tidy
---
Checks: >
-*,
misc-static-initialization-cycle
```
```foo.hpp
#pragma once
struct foo_t {
int value;
};
struct Helper {
void do_foo() { foo_t local_value; }
};
namespace cl {
void foo(Helper &writer);
} // namespace cl
#include "./foo.inl"
```
```foo.inl
#pragma once
#include "foo.hpp"
namespace cl {
void foo(Helper &writer) {
writer.do_foo();
}
} // namespace cl
```
Here are my LSP logs from the crash:
```lsp.log
[START][2026-11-22 17:39:31] LSP logging initiated
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "I[17:39:31.521] clangd version 23.1.6\nI[17:39:31.521] Features: linux\nI[17:39:31.521] PID: 70605\nI[17:39:31.521] Working directory: /tmp/tmp_cpp\nI[17:39:31.521] argv[0]: clangd\nI[17:39:31.521] Starting LSP over stdin/stdout\nI[17:39:31.522] <-- initialize(1)\nE[17:39:31.522] offsetEncoding capability is a deprecated clangd extension that'll go away with clangd 23. Migrate to standard positionEncodings capability introduced by LSP 3.17\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "I[17:39:31.522] --> reply:initialize(1) 0 ms\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "I[17:39:31.551] <-- initialized\nI[17:39:31.551] <-- textDocument/didOpen\nI[17:39:31.551] Loading config file at /tmp/tmp_cpp/.clangd\nI[17:39:31.551] --> textDocument/publishDiagnostics\nI[17:39:31.551] Failed to find compilation database for /tmp/tmp_cpp/foo.hpp\nI[17:39:31.551] ASTWorker building file /tmp/tmp_cpp/foo.hpp version 0 with command clangd fallback\n[/tmp/tmp_cpp]\n/usr/lib/llvm/23/bin/clang -resource-dir=/usr/lib/llvm/23/bin/../../../../lib/clang/23 -- /tmp/tmp_cpp/foo.hpp\nI[17:39:31.552] <-- textDocument/documentSymbol(2)\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "I[17:39:31.560] Built preamble of size 252672 for file /tmp/tmp_cpp/foo.hpp version 0 in 0.01 seconds\nI[17:39:31.561] --> workspace/semanticTokens/refresh(0)\nI[17:39:31.561] Indexing c++17 standard library in the context of /tmp/tmp_cpp/foo.hpp\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tASTMatcher: Processing 'misc-static-initialization-cycle' against:\n\tTranslationUnitDecl : <<invalid sloc>>\n--- Bound Nodes Begin ---\n TUDecl - { TranslationUnitDecl : <<invalid sloc>> }\n--- Bound Nodes End ---\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" "I[17:39:31.571] <-- reply(0)\n"
[ERROR][2026-11-22 17:39:31] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:150 "rpc" "clangd" "stderr" " #0 0x00007f54f94834ca llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/23/bin/../lib64/libLLVM.so.23.1+0xc834ca)\n #1 0x00007f54f947ff94 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/23/bin/../lib64/libLLVM.so.23.1+0xc7ff94)\n #2 0x00007f54f9480198 (/usr/lib/llvm/23/bin/../lib64/libLLVM.so.23.1+0xc80198)\n #3 0x00007f54f82642f0 (/lib64/libc.so.6+0x3d2f0)\n #4 0x000055c561bd2cdc (/usr/lib/llvm/23/bin/clangd+0x173cdc)\n #5 0x00007f5503bf5a28 clang::DynamicRecursiveASTVisitorBase<false>::TraverseDeclRefExpr(clang::DeclRefExpr*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xff5a28)\n #6 0x00007f5503b91942 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91942)\n #7 0x00007f5503bf5cb1 clang::DynamicRecursiveASTVisitorBase<false>::TraverseMemberExpr(clang::MemberExpr*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xff5cb1)\n #8 0x00007f5503b91942 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91942)\n #9 0x00007f5503b91f60 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91f60)\n#10 0x00007f5503b95476 clang::DynamicRecursiveASTVisitorBase<false>::TraverseCXXMemberCallExpr(clang::CXXMemberCallExpr*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf95476)\n#11 0x00007f5503b91942 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91942)\n#12 0x00007f5503b91f60 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91f60)\n#13 0x00007f5503b9222a clang::DynamicRecursiveASTVisitorBase<false>::TraverseCompoundStmt(clang::CompoundStmt*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf9222a)\n#14 0x00007f5503b91942 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91942)\n#15 0x00007f5503b91b04 clang::DynamicRecursiveASTVisitorBase<false>::TraverseStmt(clang::Stmt*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xf91b04)\n#16 0x000055c5625580f4 (/usr/lib/llvm/23/bin/clangd+0xaf90f4)\n#17 0x00007f5503bfc2e8 clang::DynamicRecursiveASTVisitorBase<false>::TraverseFunctionDecl(clang::FunctionDecl*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xffc2e8)\n#18 0x00007f5503bd5bcf (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xfd5bcf)\n#19 0x00007f5503bec272 clang::DynamicRecursiveASTVisitorBase<false>::TraverseNamespaceDecl(clang::NamespaceDecl*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xfec272)\n#20 0x00007f5503bec94f clang::DynamicRecursiveASTVisitorBase<false>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xfec94f)\n#21 0x00007f5503bd58f4 clang::DynamicRecursiveASTVisitorBase<false>::TraverseDecl(clang::Decl*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0xfd58f4)\n#22 0x000055c5625588e9 (/usr/lib/llvm/23/bin/clangd+0xaf98e9)\n#23 0x00007f55043e112a (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0x17e112a)\n#24 0x00007f550442135a clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0x182135a)\n#25 0x00007f55043e5584 (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0x17e5584)\n#26 0x00007f550440ad5a (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0x180ad5a)\n#27 0x00007f550440b7bb clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/usr/lib/llvm/23/bin/../lib64/libclang-cpp.so.23.1+0x180b7bb)\n#28 0x000055c561f7bfd0 (/usr/lib/llvm/23/bin/clangd+0x51cfd0)\n#29 0x000055c56201235b (/usr/lib/llvm/23/bin/clangd+0x5b335b)\n#30 0x000055c562012f37 (/usr/lib/llvm/23/bin/clangd+0x5b3f37)\n#31 0x000055c562003a63 (/usr/lib/llvm/23/bin/clangd+0x5a4a63)\n#32 0x000055c56200e4d4 (/usr/lib/llvm/23/bin/clangd+0x5af4d4)\n#33 0x000055c5621e0e06 (/usr/lib/llvm/23/bin/clangd+0x781e06)\n#34 0x00007f54f82bba5d (/lib64/libc.so.6+0x94a5d)\n#35 0x00007f54f832d88c (/lib64/libc.so.6+0x10688c)\nSignalled during AST worker action: Build AST\n Filename: foo.hpp\n Directory: /tmp/tmp_cpp\n Command Line: /usr/lib/llvm/23/bin/clang -resource-dir=/usr/lib/llvm/23/bin/../../../../lib/clang/23 -- /tmp/tmp_cpp/foo.hpp\n Version: 0\n"
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs