<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/142743>142743</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Crash in clang-scan-deps-21 from 2025-06-03 with forgotten semicolon
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          kaladron
      </td>
    </tr>
</table>

<pre>
    I am trying out a header module with this minor change:

```
import std.compat;
+import <sqlite3.h>

#include <fcntl.h>
-#include <sqlite3.h>
```

Note that I forgot that semicolon at the end of the import statement.  When I add the semicolon in, clang-scan-deps-21 does not crash.

Here is the stack trace:

```
[build] Stack dump:
[build] 0.      Program arguments: /usr/bin/clang-scan-deps-21 -format=p1689 -- /usr/bin/clang++ -DDOCDIR=\"/usr/local/share/doc/galactic-bloodshed/\" -DPKGDATADIR=\"/usr/local/share/galactic-bloodshed/\" -DPKGSTATEDIR=\"/usr/local/var/galactic-bloodshed/\" -I/workspaces/galactic-bloodshed/gb/.. -I/workspaces/galactic-bloodshed/gb/sql -stdlib=libc++ -stdlib=libc++ -Wall -Wextra -Wno-sign-compare -Wdocumentation -g -fsanitize=undefined,address -fno-omit-frame-pointer -std=gnu++26 -x c++ /workspaces/galactic-bloodshed/gb/files_shl.cc -c -o gb/CMakeFiles/gblib.dir/files_shl.cc.o -resource-dir /usr/lib/llvm-21/lib/clang/21 -MT gb/CMakeFiles/gblib.dir/files_shl.cc.o.ddi -MD -MF gb/CMakeFiles/gblib.dir/files_shl.cc.o.ddi.d
[build]  #0 0x000074531f0ae7c6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-21/bin/../lib/libLLVM.so.21.0+0x10ab7c6)
[build]  #1 0x000074531f0ac3c0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-21/bin/../lib/libLLVM.so.21.0+0x10a93c0)
[build]  #2 0x000074531f0aeef4 (/usr/lib/llvm-21/bin/../lib/libLLVM.so.21.0+0x10abef4)
[build]  #3 0x000074531dae0520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
[build]  #4 0x00007453274233f8 clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf73f8)
[build]  #5 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build]  #6 0x0000745327450bf5 clang::Preprocessor::CheckEndOfDirective(char const*, bool) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb24bf5)
[build] #7 0x0000745327454034 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb28034)
[build] #8 0x00007453274547df clang::Preprocessor::HandleDirective(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb287df)
[build]  #9 0x000074532742365c clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf765c)
[build] #10 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #11 0x0000745327450975 clang::Preprocessor::CheckEndOfDirective(char const*, bool) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb24975)
[build] #12 0x0000745327454034 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb28034)
[build] #13 0x00007453274547df clang::Preprocessor::HandleDirective(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb287df)
[build] #14 0x000074532742365c clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf765c)
[build] #15 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #16 0x0000745327450975 clang::Preprocessor::CheckEndOfDirective(char const*, bool) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb24975)
[build] #17 0x0000745327454034 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb28034)
[build] #18 0x00007453274547df clang::Preprocessor::HandleDirective(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb287df)
[build] #19 0x000074532742365c clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf765c)
[build] #20 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #21 0x0000745327450975 clang::Preprocessor::CheckEndOfDirective(char const*, bool) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb24975)
[build] #22 0x0000745327454034 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb28034)
[build] #23 0x00007453274547df clang::Preprocessor::HandleDirective(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb287df)
[build] #24 0x000074532742365c clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf765c)
[build] #25 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #26 0x0000745327450975 clang::Preprocessor::CheckEndOfDirective(char const*, bool) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb24975)
[build] #27 0x0000745327454034 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb28034)
[build] #28 0x00007453274547df clang::Preprocessor::HandleDirective(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb287df)
[build] #29 0x000074532742365c clang::Lexer::LexDependencyDirectiveToken(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xaf765c)
[build] #30 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #31 0x0000745327488277 clang::Preprocessor::CollectPpImportSuffix(llvm::SmallVectorImpl<clang::Token>&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5c277)
[build] #32 0x0000745327488454 clang::Preprocessor::LexAfterModuleImport(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5c454)
[build] #33 0x000074532748740d clang::Preprocessor::Lex(clang::Token&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0xb5b40d)
[build] #34 0x00007453290cf39b clang::PreprocessOnlyAction::ExecuteAction() (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x27a339b)
[build] #35 0x00007453290c5e7b clang::FrontendAction::Execute() (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x2799e7b)
[build] #36 0x0000745329039774 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x270d774)
[build] #37 0x0000745329285df0 (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x2959df0)
[build] #38 0x00007453292d2b0b clang::tooling::ToolInvocation::run() (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x29a6b0b)
[build] #39 0x0000745329284312 (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x2958312)
[build] #40 0x00007453292836f0 clang::tooling::dependencies::DependencyScanningWorker::scanDependencies(llvm::StringRef, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, clang::DiagnosticConsumer&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::optional<llvm::StringRef>) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x29576f0)
[build] #41 0x00007453292823dc clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(llvm::StringRef, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, clang::DiagnosticConsumer&, std::optional<llvm::MemoryBufferRef>) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x29563dc)
[build] #42 0x0000745329281dbc clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(llvm::StringRef, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, std::optional<llvm::MemoryBufferRef>) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x2955dbc)
[build] #43 0x000074532928b158 clang::tooling::dependencies::DependencyScanningTool::getP1689ModuleDependencyFile(clang::tooling::CompileCommand const&, llvm::StringRef, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) (/usr/lib/llvm-21/bin/../lib/libclang-cpp.so.21.0+0x295f158)
[build] #44 0x0000605a37e26144 (/usr/bin/clang-scan-deps-21+0xc144)
[build] #45 0x0000605a37e249a9 (/usr/bin/clang-scan-deps-21+0xa9a9)
[build] #46 0x0000605a37e3d576 (/usr/bin/clang-scan-deps-21+0x23576)
[build] #47 0x000074531dac7d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
[build] #48 0x000074531dac7e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
[build] #49 0x0000605a37e22e45 (/usr/bin/clang-scan-deps-21+0x8e45)
[build] Segmentation fault (core dumped)
```

I am using the packages from apt.llvm.org version 1:21~++20250603043403+458307694ebd-1~exp1~20250603043545.2455.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsW01z2zjS_jXwBUUVCPDz4IMtRe-o3njHFacmRxcINCWsSUADgI68h_ntW6Qky2SoxMkoM6NaV-kg4aP76UZ346EIcOfUUgNcovgaxbML3viVsZcPvOLSGn1RGPl0ucC8xt4-Kb3EpvGY4xVwCRbXRjYV4M_Kr7BfKYdrpY3FYsX1EhC7QqT7JGT3IVeqXhvrsfNyIky95h6x63YIvd71IDZ1v1fKA5usEHu3k0CZ0qJqJLT9pdC-2vcG_b7h3BeqEbn6l_GA_Yp7vMClsUvjt78c1EqYymjM2xbAoCU2Zff1GTH3UIP2E4w_rUDjBeZSdiMOs5VGdIpFxfUycILrQMLaBTTE0oDD2ngsLHeryRbNL2ABK7eV4bl4wN5yMe43FF8Xjaokimf4rhsrm3q9G_qij0wQyW-tWVpeY26XTQvZIXaFEZ03ziI6L1qU8xGQQWls3a7IbB0mWY6DYHQSoteIXuNgNvt1Olt8QG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