| Issue |
87174
|
| Summary |
Clang Tidy Crash
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
F0bes
|
Hello, I was experimenting using clang-tidy (version 14) and ran into a crash.
I can't reproduce it on my machine directly, only using github actions or `act`.
I've tested both with clang 14 and GCC 12.3, I'm unsure if that is relevant for this issue though.
The backtrace is located [here](https://github.com/F0bes/gifscript/actions/runs/8494915473/job/23270632256)
<details>
<summary>Embedded text version</summary>
```
Error running 'clang-tidy': PLEASE submit a bug report to [https://github.com/llvm/llvm-project/issues/](https://github.com/llvm/llvm-project/issues/?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and include the crash backtrace.
Stack dump:
0. Program arguments: clang-tidy -checks=-*,readability-*,modernize-*,performance-*,portability-*,bugprone-*,clang-analyzer-* --extra-arg-before=--driver-mode=g++ /home/runner/work/gifscript/gifscript/backend/c_code.cpp -- /usr/bin/g++-12 -I/home/runner/work/gifscript/gifscript -I/home/runner/work/gifscript/gifscript/build/_deps/fmt-src/include -DGIT_VERSION=\"84ab\" -Wall -Werror -Wno-unused-const-variable -std=c++2b -MD -MT CMakeFiles/gifscript.dir/backend/c_code.cpp.o -MF CMakeFiles/gifscript.dir/backend/c_code.cpp.o.d -o CMakeFiles/gifscript.dir/backend/c_code.cpp.o -c /home/runner/work/gifscript/gifscript/backend/c_code.cpp
1. <eof> parser at end of file
#0 0x00007f25ecc3fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
#1 0x00007f25ecc3da3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e)
#2 0x00007f25ecc40236 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe40236)
#3 0x00007f25eb642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f25f3639d0b clang::Stmt::getEndLoc() const (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xe39d0b)
#5 0x0000000000a625b4 clang::SourceLocation clang::tidy::readability::BracesAroundStatementsCheck::findRParenLoc<clang::IfStmt>(clang::IfStmt const*, clang::SourceManager const&, clang::ASTContext const*) (/usr/lib/llvm-14/bin/clang-tidy+0xa625b4)
#6 0x0000000000a61db0 clang::tidy::readability::BracesAroundStatementsCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/usr/lib/llvm-14/bin/clang-tidy+0xa61db0)
#7 0x00007f25f386def7 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x106def7)
#8 0x00007f25f389f99c clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x109f99c)
#9 0x00007f25f386d977 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x106d977)
#10 0x00007f25f387b585 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x107b585)
#11 0x00007f25f38794f9 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x10794f9)
#12 0x00007f25f389f2b1 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x109f2b1)
#13 0x00007f25f3875862 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1075862)
#14 0x00007f25f3870284 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1070284)
#15 0x00007f25f3871a2b (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1071a2b)
#16 0x00007f25f386fc51 (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x106fc51)
#17 0x00007f25f3877fab (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1077fab)
#18 0x00007f25f386feaf (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x106feaf)
#19 0x00007f25f3841307 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1041307)
#20 0x00007f25f4d4fd7c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x254fd7c)
#21 0x00007f25f3204824 clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0xa04824)
#22 0x00007f25f4d14b57 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2514b57)
#23 0x00007f25f4c6c3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x246c3a6)
#24 0x00007f25f4f12423 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2712423)
#25 0x0000000000bb78ea (/usr/lib/llvm-14/bin/clang-tidy+0xbb78ea)
#26 0x00007f25f4f12175 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2712175)
#27 0x00007f25f4f11183 clang::tooling::ToolInvocation::run() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2711183)
#28 0x00007f25f4f13d0e clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2713d0e)
#29 0x0000000000bb301d 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) (/usr/lib/llvm-14/bin/clang-tidy+0xbb301d)
#30 0x00000000005b02ae clang::tidy::clangTidyMain(int, char const**) (/usr/lib/llvm-14/bin/clang-tidy+0x5b02ae)
#31 0x00007f25eb629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#32 0x00007f25eb629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#33 0x00000000005ac1c5 _start (/usr/lib/llvm-14/bin/clang-tidy+0x5ac1c5)
Segmentation fault
```
</details>
You should be able to test it yourself by checking out this branch https://github.com/F0bes/gifscript/tree/broken-clang-tidy
[commit sha if/when the branch gets deleted in the future](https://github.com/F0bes/gifscript/commit/84ab0cb9caa1811f994365c69dad05a2ab0a2720) and running the github action 'branch-build'
Hope it's enough information. I couldn't provide a better reproducible sample.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs