Open
Description
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-1exp120250603043545.2455.