<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56250>56250</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] crash when analysing nested class defintion
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
correaa
</td>
</tr>
</table>
<pre>
I have a class and a nested class definition.
```cpp
class communicator {
...
class iterator {
};
};
```
Even with an empty nested class, clang-tidy (13.0.0) crashes.
You can find the approximate locations of the lines in the source code here: https://gitlab.com/correaa/boost-mpi3
Here it is the trace:
```
cd /home/correaa/prj/alf/boost/mpi3/.build.clang++/test && /usr/bin/cmake -E __run_co_compile --tidy="clang-tidy;--extra-arg-before=--driver-mode=g++" --source=/home/correaa/prj/alf/boost/mpi3/test/communicator_all_gatherv.cpp -- /usr/bin/clang++ -I/home/correaa/prj/alf/boost/mpi3/test/../../../.. -isystem /usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/x86_64-linux-gnu/openmpi/include -g -Wall -Wextra -Werror -Wfatal-errors -std=gnu++17 -o CMakeFiles/communicator_all_gatherv.cpp.x.dir/communicator_all_gatherv.cpp.o -c /home/correaa/prj/alf/boost/mpi3/test/communicator_all_gatherv.cpp
Error running 'clang-tidy': PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: clang-tidy --extra-arg-before=--driver-mode=g++ /home/correaa/prj/alf/boost/mpi3/test/communicator_igather.cpp -- /usr/bin/clang++ -I/home/correaa/prj/alf/boost/mpi3/test/../../../.. -isystem /usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/x86_64-linux-gnu/openmpi/include -g -Wall -Wextra -Werror -Wfatal-errors -std=gnu++17 -o CMakeFiles/communicator_igather.cpp.x.dir/communicator_igather.cpp.o -c /home/correaa/prj/alf/boost/mpi3/test/communicator_igather.cpp
1. <eof> parser at end of file
2. While analyzing stack:
#0 Calling boost::mpi3::request::wait() at line /home/correaa/prj/alf/boost/mpi3/test/../../mpi3/../mpi3/request.hpp:51:4
#1 Calling boost::mpi3::request::~request()
#2 Calling boost::mpi3::main(int, char **, mpi3::communicator)
3. /home/correaa/prj/alf/boost/mpi3/test/../../mpi3/../mpi3/request.hpp:61:12: Error evaluating statement
4. /home/correaa/prj/alf/boost/mpi3/test/../../mpi3/../mpi3/request.hpp:61:12: Error evaluating statement
#0 0x00007ff2143f6183 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb9183)
#1 0x00007ff2143f4500 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb7500)
#2 0x00007ff2143f661a (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb961a)
#3 0x00007ff213340520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007ff21bb782e2 clang::ento::mpi::MPIChecker::checkUnmatchedWaits(clang::ento::CallEvent const&, clang::ento::CheckerContext&) const (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x27572e2)
#5 0x00007ff21bb7a224 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2759224)
#6 0x00007ff21b97f4fe clang::ento::CheckerManager::runCheckersForCallEvent(bool, clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNodeSet const&, clang::ento::CallEvent const&, clang::ento::ExprEngine&, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x255e4fe)
#7 0x00007ff21b9bb4b2 clang::ento::ExprEngine::evalCall(clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNode*, clang::ento::CallEvent const&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x259a4b2)
#8 0x00007ff21b9bb1f8 clang::ento::ExprEngine::VisitCallExpr(clang::CallExpr const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x259a1f8)
#9 0x00007ff21b9a1499 clang::ento::ExprEngine::Visit(clang::Stmt const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2580499)
#10 0x00007ff21b99d33a clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*, clang::ento::ExplodedNode*) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x257c33a)
#11 0x00007ff21b99cff3 clang::ento::ExprEngine::processCFGElement(clang::CFGElement, clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x257bff3)
#12 0x00007ff21b988905 clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*, clang::ProgramPoint, clang::ento::WorkListUnit const&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2567905)
#13 0x00007ff21b988653 clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*, unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2567653)
#14 0x00007ff21bce1b05 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x28c0b05)
#15 0x00007ff21bccaa38 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x28a9a38)
#16 0x00007ff21b78ab9c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2369b9c)
#17 0x00007ff21a00c544 clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xbeb544)
#18 0x00007ff21b752748 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2331748)
#19 0x00007ff21b6d3a56 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x22b2a56)
#20 0x00007ff21b9007ff 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.13+0x24df7ff)
#21 0x000000000097b179 (/usr/lib/llvm-13/bin/clang-tidy+0x97b179)
#22 0x00007ff21b90057a 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.13+0x24df57a)
#23 0x00007ff21b8ff88d clang::tooling::ToolInvocation::run() (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x24de88d)
#24 0x00007ff21b901b89 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x24e0b89)
#25 0x0000000000977af7 (/usr/lib/llvm-13/bin/clang-tidy+0x977af7)
#26 0x000000000045e790 (/usr/lib/llvm-13/bin/clang-tidy+0x45e790)
#27 0x00007ff213327fd0 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#28 0x00007ff21332807d call_init ./csu/../csu/libc-start.c:128:20
#29 0x00007ff21332807d __libc_start_main ./csu/../csu/libc-start.c:379:5
#30 0x000000000045ad05 (/usr/lib/llvm-13/bin/clang-tidy+0x45ad05)
Segmentation fault
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWktzo7gW_jVko4IC8V5kkXbs26lKZlKTnknNyiVA2JrGwBUicebXz5EAGxE77dh9q2Zxu1xEgPTpnO88dJA6qbK36zu0Ji8UEZQWpGkQKTNol7QRNOsfZTRnJROsKi3DvjXsm_4a2N0vrevuSdc9rTabtmQpERVHRvile4cQsiwL7W66vkxQ_q6fEd4abn-rtYcJx1LMX2iJXplYg-SIbmrxpglv4JlslCtTsOwNGThyXMu2bAPHKOWkWdOm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