<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88485>88485</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bus error (core dumped) in clang-tidy when parsing valid C++
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gaultier
</td>
</tr>
</table>
<pre>
Exact file names in the project have been replaced by `[...]`.
```
Stack dump:
0. Program arguments: clang-tidy -p [...] --warnings-as-errors=* --quiet --checks=clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-avoid-capturing-lambda-coroutines,cppcoreguidelines-avoid-const-or-ref-data-members,cppcoreguidelines-avoid-do-while,cppcoreguidelines-avoid-reference-coroutine-parameters,cppcoreguidelines-c-copy-assignment-signature,cppcoreguidelines-explicit-virtual-functions,cppcoreguidelines-init-variables,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-misleading-capture-default-by-value,cppcoreguidelines-missing-std-forward,cppcoreguidelines-noexcept-destructor,cppcoreguidelines-noexcept-move-operations,cppcoreguidelines-noexcept-swap,cppcoreguidelines-pro-type-const-cast,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-pro-type-reinterpret-cast,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-rvalue-reference-param-not-moved,cppcoreguidelines-slicing,cppcoreguidelines-special-member-functions,cppcoreguidelines-use-default-member-init,cppcoreguidelines-virtual-class-destructor,modernize-use-nullptr,modernize-use-override
1. [...]/src/src/global.h:16:2: current parser token 'include'
2. /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/vector:81:1: parsing namespace 'std'
#0 0x000060e3d05954d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/clang-tidy+0x29ae4d8)
#1 0x000060e3d05933fe llvm::sys::RunSignalHandlers() (/usr/local/bin/clang-tidy+0x29ac3fe)
#2 0x000060e3d0595e48 SignalHandler(int) Signals.cpp:0:0
#3 0x00007c613eb91990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
#4 0x000060e3d062f47e clang::SrcMgr::ContentCache::getInvalidBOM(llvm::StringRef) (/usr/local/bin/clang-tidy+0x2a4847e)
#5 0x000060e3d062f644 clang::SrcMgr::ContentCache::getBufferOrNone(clang::DiagnosticsEngine&, clang::FileManager&, clang::SourceLocation) const (/usr/local/bin/clang-tidy+0x2a48644)
#6 0x000060e3d3066f29 clang::Preprocessor::EnterSourceFile(clang::FileID, clang::detail::SearchDirIteratorImpl<true>, clang::SourceLocation, bool) (/usr/local/bin/clang-tidy+0x547ff29)
#7 0x000060e3d305ccd7 clang::Preprocessor::HandleHeaderIncludeOrImport(clang::SourceLocation, clang::Token&, clang::Token&, clang::SourceLocation, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/local/bin/clang-tidy+0x5475cd7)
#8 0x000060e3d3055f75 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/local/bin/clang-tidy+0x546ef75)
#9 0x000060e3d305699d clang::Preprocessor::HandleDirective(clang::Token&) (/usr/local/bin/clang-tidy+0x546f99d)
#10 0x000060e3d3029a3d clang::Lexer::LexTokenInternal(clang::Token&, bool) (/usr/local/bin/clang-tidy+0x5442a3d)
#11 0x000060e3d308d099 clang::Preprocessor::Lex(clang::Token&) (/usr/local/bin/clang-tidy+0x54a6099)
#12 0x000060e3d1eebbbf clang::Parser::ConsumeBrace() Parser.cpp:0:0
#13 0x000060e3d1ef33d7 clang::BalancedDelimiterTracker::consumeClose() Parser.cpp:0:0
#14 0x000060e3d1f2ac0f clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/local/bin/clang-tidy+0x4343c0f)
#15 0x000060e3d1f2a2e7 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/local/bin/clang-tidy+0x43432e7)
#16 0x000060e3d1f4b42f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/local/bin/clang-tidy+0x436442f)
#17 0x000060e3d1eee793 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/local/bin/clang-tidy+0x4307793)
#18 0x000060e3d1eed3c4 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/local/bin/clang-tidy+0x43063c4)
#19 0x000060e3d1ee93de clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang-tidy+0x43023de)
#20 0x000060e3d1c73dc7 clang::FrontendAction::Execute() (/usr/local/bin/clang-tidy+0x408cdc7)
#21 0x000060e3d1be1814 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang-tidy+0x3ffa814)
#22 0x000060e3d0607f50 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/usr/local/bin/clang-tidy+0x2a20f50)
#23 0x000060e3d0662d51 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)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) ClangTidy.cpp:0:0
#24 0x000060e3d0607cf0 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (/usr/local/bin/clang-tidy+0x2a20cf0)
#25 0x000060e3d060661c clang::tooling::ToolInvocation::run() (/usr/local/bin/clang-tidy+0x2a1f61c)
#26 0x000060e3d060963f clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/usr/local/bin/clang-tidy+0x2a2263f)
#27 0x000060e3d065dfb6 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/local/bin/clang-tidy+0x2a76fb6)
#28 0x000060e3d0564e44 clang::tidy::clangTidyMain(int, char const**) (/usr/local/bin/clang-tidy+0x297de44)
#29 0x00007c613eb77150 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#30 0x00007c613eb77209 call_init ./csu/../csu/libc-start.c:128:20
#31 0x00007c613eb77209 __libc_start_main ./csu/../csu/libc-start.c:347:5
#32 0x000060e3d055ffa5 _start (/usr/local/bin/clang-tidy+0x2978fa5)
bash: line 1: 182135 Bus error (core dumped)
```
Version:
```
$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 17.0.2
Optimized build.
```
OS: Ubuntu 23.10
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl9v2zgS_zTKiyBDIvX3IQ-OE98GaDfFprevAUWObF4pSktSjr2f_kBJlk3HduvdAgscrnAdWRwOf_Ob4XBIiWjNVxLg3ksevOTxjnRm3aj7FemE4aDuyobt7p-2hBq_4gJ8SWrQPpe-WYPfquY_QI2_JhvwSwDpK2gFocD8cud7aeglD7PZzEsevTSceeGjF87H7zQcP_3PV0PoN591devhUcLKF19Us1Kk9oladTVIoz0896kgchUYzn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