Skip to content
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

Crash running clang-tidy #131540

Closed
orebas opened this issue Mar 16, 2025 · 4 comments
Closed

Crash running clang-tidy #131540

orebas opened this issue Mar 16, 2025 · 4 comments
Labels
clang-tidy crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@orebas
Copy link

orebas commented Mar 16, 2025

Hello, I was running clang-tidy and it crashed. It seems to replicate. I am in WSL2 on windows 11, using Ubuntu 24.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/clang-tidy -p /home/orebas/cpp/spml/build /home/orebas/cpp/spml/include/spml/spml.hpp /home/orebas/cpp/spml/spml.cpp /home/orebas/cpp/spml/spml.hpp

  1.  <eof> parser at end of file
    
  2.  ASTMatcher: Processing 'modernize-use-constraints' against:
     FunctionTemplateDecl boost::multiprecision::abs : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2337:1, line:2342:1>
    

--- Bound Nodes Begin ---
function - { FunctionDecl boost::multiprecision::abs : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2338:1, line:2342:1> }
functionTemplate - { FunctionTemplateDecl boost::multiprecision::abs : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2337:1, line:2342:1> }
return - { DependentNameTypeLoc : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2338:33, col:162> }
--- Bound Nodes End ---
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
0 libLLVM.so.18.1 0x00007f8d360383bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63
1 libLLVM.so.18.1 0x00007f8d360364f9 llvm::sys::RunSignalHandlers() + 89
2 libLLVM.so.18.1 0x00007f8d36038b00
3 libc.so.6 0x00007f8d34d3d330
4 clang-tidy 0x000055ee45e13035
5 clang-tidy 0x000055ee45e1202b clang::tidy::modernize::UseConstraintsCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) + 155
6 clang-tidy 0x000055ee46124f15
7 clang-tidy 0x000055ee4615800c clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) + 156
8 clang-tidy 0x000055ee4612465f
9 clang-tidy 0x000055ee461271eb
10 clang-tidy 0x000055ee4612996b
11 clang-tidy 0x000055ee46127747
12 clang-tidy 0x000055ee4612996b
13 clang-tidy 0x000055ee46127747
14 clang-tidy 0x000055ee461546eb
15 clang-tidy 0x000055ee46127b89
16 clang-tidy 0x000055ee46127213
17 clang-tidy 0x000055ee460f9825 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) + 709
18 libclang-cpp.so.18.1 0x00007f8d3f2dffbc clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
19 libclang-cpp.so.18.1 0x00007f8d3d4343d6 clang::ParseAST(clang::Sema&, bool, bool) + 598
20 libclang-cpp.so.18.1 0x00007f8d3f2a362c clang::FrontendAction::Execute() + 92
21 libclang-cpp.so.18.1 0x00007f8d3f2200b4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 708
22 libclang-cpp.so.18.1 0x00007f8d3f4976b9 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptrclang::CompilerInvocation, clang::FileManager*, std::shared_ptrclang::PCHContainerOperations, clang::DiagnosticConsumer*) + 425
23 clang-tidy 0x000055ee46778ab3
24 libclang-cpp.so.18.1 0x00007f8d3f497414 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptrclang::CompilerInvocation, std::shared_ptrclang::PCHContainerOperations) + 292
25 libclang-cpp.so.18.1 0x00007f8d3f49617f clang::tooling::ToolInvocation::run() + 1231
26 libclang-cpp.so.18.1 0x00007f8d3f4991c1 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) + 5041
27 clang-tidy 0x000055ee46774d9b clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::IntrusiveRefCntPtrllvm::vfs::OverlayFileSystem, bool, bool, llvm::StringRef) + 1083
28 clang-tidy 0x000055ee45af4c65 clang::tidy::clangTidyMain(int, char const**) + 10005
29 libc.so.6 0x00007f8d34d221ca
30 libc.so.6 0x00007f8d34d2228b __libc_start_main + 139
31 clang-tidy 0x000055ee45aeffe5 _start + 37
[1] 2004 segmentation fault (core dumped) /usr/bin/clang-tidy -p /home/orebas/cpp/spml/build

@llvmbot
Copy link
Member

llvmbot commented Mar 16, 2025

@llvm/issue-subscribers-clang-tidy

Author: None (orebas)

Hello, I was running clang-tidy and it crashed. It seems to replicate. I am in WSL2 on windows 11, using Ubuntu 24.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/clang-tidy -p /home/orebas/cpp/spml/build /home/orebas/cpp/spml/include/spml/spml.hpp /home/orebas/cpp/spml/spml.cpp /home/orebas/cpp/spml/spml.hpp

  1.  &lt;eof&gt; parser at end of file
    
  2.  ASTMatcher: Processing 'modernize-use-constraints' against:
     FunctionTemplateDecl boost::multiprecision::abs : &lt;/usr/local/include/boost/multiprecision/detail/default_ops.hpp:2337:1, line:2342:1&gt;
    

--- Bound Nodes Begin ---
function - { FunctionDecl boost::multiprecision::abs : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2338:1, line:2342:1> }
functionTemplate - { FunctionTemplateDecl boost::multiprecision::abs : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2337:1, line:2342:1> }
return - { DependentNameTypeLoc : </usr/local/include/boost/multiprecision/detail/default_ops.hpp:2338:33, col:162> }
--- Bound Nodes End ---
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
0 libLLVM.so.18.1 0x00007f8d360383bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63
1 libLLVM.so.18.1 0x00007f8d360364f9 llvm::sys::RunSignalHandlers() + 89
2 libLLVM.so.18.1 0x00007f8d36038b00
3 libc.so.6 0x00007f8d34d3d330
4 clang-tidy 0x000055ee45e13035
5 clang-tidy 0x000055ee45e1202b clang::tidy::modernize::UseConstraintsCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) + 155
6 clang-tidy 0x000055ee46124f15
7 clang-tidy 0x000055ee4615800c clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) + 156
8 clang-tidy 0x000055ee4612465f
9 clang-tidy 0x000055ee461271eb
10 clang-tidy 0x000055ee4612996b
11 clang-tidy 0x000055ee46127747
12 clang-tidy 0x000055ee4612996b
13 clang-tidy 0x000055ee46127747
14 clang-tidy 0x000055ee461546eb
15 clang-tidy 0x000055ee46127b89
16 clang-tidy 0x000055ee46127213
17 clang-tidy 0x000055ee460f9825 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) + 709
18 libclang-cpp.so.18.1 0x00007f8d3f2dffbc clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
19 libclang-cpp.so.18.1 0x00007f8d3d4343d6 clang::ParseAST(clang::Sema&, bool, bool) + 598
20 libclang-cpp.so.18.1 0x00007f8d3f2a362c clang::FrontendAction::Execute() + 92
21 libclang-cpp.so.18.1 0x00007f8d3f2200b4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 708
22 libclang-cpp.so.18.1 0x00007f8d3f4976b9 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) + 425
23 clang-tidy 0x000055ee46778ab3
24 libclang-cpp.so.18.1 0x00007f8d3f497414 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) + 292
25 libclang-cpp.so.18.1 0x00007f8d3f49617f clang::tooling::ToolInvocation::run() + 1231
26 libclang-cpp.so.18.1 0x00007f8d3f4991c1 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) + 5041
27 clang-tidy 0x000055ee46774d9b clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) + 1083
28 clang-tidy 0x000055ee45af4c65 clang::tidy::clangTidyMain(int, char const**) + 10005
29 libc.so.6 0x00007f8d34d221ca
30 libc.so.6 0x00007f8d34d2228b __libc_start_main + 139
31 clang-tidy 0x000055ee45aeffe5 _start + 37
[1] 2004 segmentation fault (core dumped) /usr/bin/clang-tidy -p /home/orebas/cpp/spml/build

@orebas
Copy link
Author

orebas commented Mar 16, 2025

Below is my .clang-tidy
clang-tidy --version returns ➜ spml clang-tidy --version
Ubuntu LLVM version 18.1.3
Optimized build.

#Some of these exclusions might want to be added back periodically.
Checks: '
    *,
    -abseil-*,
    -altera-*,
    -android-*,
    -fuchsia-*,
  #  -google-*,
    -llvm*,
    -modernize-use-trailing-return-type,
    -zircon-*,
    -readability-else-after-return,
    -readability-static-accessed-through-instance,
    -readability-avoid-const-params-in-decls,
    -clang-diagnostic-sign-conversion,
    -cppcoreguidelines-non-private-member-variables-in-classes,
    -misc-non-private-member-variables-in-classes,
    -cppcoreguidelines-avoid-magic-numbers,
    -readability-magic-numbers,
    -cppcoreguidelines-pro-type-vararg,
    -hicpp-vararg,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    -cppcoreguidelines-avoid-c-arrays,
    -modernize-avoid-c-arrays,
    -hicpp-avoid-c-arrays,
    -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
    -hicpp-no-array-decay,
    -readability-identifier-length,
    -misc-include-cleaner,
    -readability-function-cognitive-complexity,
    -cppcoreguidelines-avoid-do-while,
    '
WarningsAsErrors: ''
HeaderFilterRegex: 'project/HC-MC/.*'
FormatStyle: 'file'

# Disable specific checks in specific files
CheckOptions:
  - key: readability-function-cognitive-complexity.Threshold
    value: '25'
  - key: readability-function-size.LineThreshold
    value: '100'

@vbvictor
Copy link
Contributor

It was fixed by #92019.
Those fixes must be present in clang-tidy-20, you may use https://apt.llvm.org/ to install this version.

@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Mar 16, 2025
@AaronBallman
Copy link
Collaborator

We believe this is fixed in clang-tidy-20, but if you are still able to reproduce, please reopen the issue and attach some example code which reproduces the issue. Thank you!

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

No branches or pull requests

5 participants