Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clangd 19 crashing when using C++20 Modules #97688

Closed
ilobilo opened this issue Jul 4, 2024 · 2 comments
Closed

clangd 19 crashing when using C++20 Modules #97688

ilobilo opened this issue Jul 4, 2024 · 2 comments
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@ilobilo
Copy link

ilobilo commented Jul 4, 2024

clangd crashes if a .cppm file contains #include <fmt/ranges.h>

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	<eof> parser at end of file
V[11:52:59.010] indexed preamble AST for /home/ilobilo/Desktop/projects/visualsort/source/visualsort.cppm version 1:
  symbol slab: 7292 symbols, 1986776 bytes
  ref slab: 0 symbols, 0 refs, 128 bytes
  relations slab: 375 relations, 8728 bytes
V[11:52:59.027] Build dynamic index for header symbols with estimated memory usage of 6386280 bytes
 #0 0x00007e70b46acc2f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xeacc2f)
 #1 0x00007e70b46aa929 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xeaa929)
 #2 0x00007e70b46ad380 (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xead380)
 #3 0x00007e70b2645320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
 #4 0x00007e70bc61ef63 clang::StmtIteratorBase::HandleDecl(clang::Decl*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x121ef63)
 #5 0x00007e70bc61f07b clang::StmtIteratorBase::StmtIteratorBase(clang::Decl**, clang::Decl**) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x121f07b)
 #6 0x00007e70bc616d65 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1216d65)
 #7 0x00007e70bc6169ba clang::Stmt::children() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x12169ba)
 #8 0x00007e70bc66e329 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126e329)
 #9 0x00007e70bc66dda5 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126dda5)
#10 0x00007e70bc66e3af (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126e3af)
#11 0x00007e70bc66a451 clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&, clang::ODRHash&) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126a451)
#12 0x00007e70bc5de2c9 clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x11de2c9)
#13 0x00007e70bc2f8779 clang::FunctionDecl::getODRHash() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xef8779)
#14 0x00007e70bdec4adf clang::ASTReader::finishPendingActions() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac4adf)
#15 0x00007e70bdec7b3b clang::ASTReader::FinishedDeserializing() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac7b3b)
#16 0x00007e70bc30c7ec clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xf0c7ec)
#17 0x00007e70bc30cf1b clang::DeclContext::decls_begin() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xf0cf1b)
#18 0x00007e70bdec5577 clang::ASTReader::diagnoseOdrViolations() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac5577)
#19 0x00007e70bdec7b72 clang::ASTReader::FinishedDeserializing() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac7b72)
#20 0x00007e70bdf10586 clang::ASTReader::ReadDeclRecord(clang::GlobalDeclID) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2b10586)
#21 0x00007e70bdeb2ec7 clang::ASTReader::GetDecl(clang::GlobalDeclID) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ab2ec7)
#22 0x00007e70bc608ab5 clang::ASTContext::getCurrentKeyFunction(clang::CXXRecordDecl const*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1208ab5)
#23 0x00007e70bcbe97a0 clang::Sema::DefineUsedVTables() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x17e97a0)
#24 0x00007e70bc980b8a clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1580b8a)
#25 0x00007e70bc981320 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1581320)
#26 0x00007e70bc109144 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd09144)
#27 0x00007e70bc0380ae clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc380ae)
#28 0x00007e70be10140c clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d0140c)
#29 0x000059b5f0856813 (/usr/bin/clangd+0x3e7813)
#30 0x000059b5f08f51e4 (/usr/bin/clangd+0x4861e4)
#31 0x000059b5f08f4c3a (/usr/bin/clangd+0x485c3a)
#32 0x000059b5f08f1400 (/usr/bin/clangd+0x482400)
#33 0x000059b5f08f0f76 (/usr/bin/clangd+0x481f76)
#34 0x000059b5f0a571d1 (/usr/bin/clangd+0x5e81d1)
#35 0x00007e70b269ca94 start_thread ./nptl/pthread_create.c:447:8
#36 0x00007e70b2729c3c clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0
Signalled during AST worker action: Build AST
  Filename: source/visualsort.cppm
  Directory: /home/ilobilo/Desktop/projects/visualsort
  Command Line: /usr/lib/llvm-19/bin/clang -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Werror -O3 -std=c++23 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -I /home/ilobilo/.xmake/packages/f/ftxui/v5.0.0/bfd210310c974f0bbb9fbb748ac7aae4/include -I /home/ilobilo/.xmake/packages/f/fmt/11.0.0/920a4073dd28420f9c79ca3b805f8e91/include -DNDEBUG -fmodule-file=visualsort:bubblesort=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort-bubblesort.pcm -fmodule-file=std=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/std.pcm -fmodule-file=visualsort:sorter=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort-sorter.pcm -x c++-module -fmodule-output=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort.pcm -o build/.objs/visualsort/linux/x86_64/release/source/visualsort.cppm.o -resource-dir=/usr/lib/llvm-19/lib/clang/19 -- /home/ilobilo/Desktop/projects/visualsort/source/visualsort.cppm
  Version: 1
@EugeneZelenko EugeneZelenko added clangd crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jul 4, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 4, 2024

@llvm/issue-subscribers-clangd

Author: ilobilo (ilobilo)

clangd crashes if a ``.cppm`` file contains ``#include <fmt/ranges.h>`` ``` PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. <eof> parser at end of file V[11:52:59.010] indexed preamble AST for /home/ilobilo/Desktop/projects/visualsort/source/visualsort.cppm version 1: symbol slab: 7292 symbols, 1986776 bytes ref slab: 0 symbols, 0 refs, 128 bytes relations slab: 375 relations, 8728 bytes V[11:52:59.027] Build dynamic index for header symbols with estimated memory usage of 6386280 bytes #0 0x00007e70b46acc2f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xeacc2f) #1 0x00007e70b46aa929 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xeaa929) #2 0x00007e70b46ad380 (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xead380) #3 0x00007e70b2645320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320) #4 0x00007e70bc61ef63 clang::StmtIteratorBase::HandleDecl(clang::Decl*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x121ef63) #5 0x00007e70bc61f07b clang::StmtIteratorBase::StmtIteratorBase(clang::Decl**, clang::Decl**) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x121f07b) #6 0x00007e70bc616d65 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1216d65) #7 0x00007e70bc6169ba clang::Stmt::children() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x12169ba) #8 0x00007e70bc66e329 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126e329) #9 0x00007e70bc66dda5 (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126dda5) #10 0x00007e70bc66e3af (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126e3af) #11 0x00007e70bc66a451 clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&, clang::ODRHash&) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x126a451) #12 0x00007e70bc5de2c9 clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x11de2c9) #13 0x00007e70bc2f8779 clang::FunctionDecl::getODRHash() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xef8779) #14 0x00007e70bdec4adf clang::ASTReader::finishPendingActions() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac4adf) #15 0x00007e70bdec7b3b clang::ASTReader::FinishedDeserializing() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac7b3b) #16 0x00007e70bc30c7ec clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xf0c7ec) #17 0x00007e70bc30cf1b clang::DeclContext::decls_begin() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xf0cf1b) #18 0x00007e70bdec5577 clang::ASTReader::diagnoseOdrViolations() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac5577) #19 0x00007e70bdec7b72 clang::ASTReader::FinishedDeserializing() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ac7b72) #20 0x00007e70bdf10586 clang::ASTReader::ReadDeclRecord(clang::GlobalDeclID) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2b10586) #21 0x00007e70bdeb2ec7 clang::ASTReader::GetDecl(clang::GlobalDeclID) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2ab2ec7) #22 0x00007e70bc608ab5 clang::ASTContext::getCurrentKeyFunction(clang::CXXRecordDecl const*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1208ab5) #23 0x00007e70bcbe97a0 clang::Sema::DefineUsedVTables() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x17e97a0) #24 0x00007e70bc980b8a clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1580b8a) #25 0x00007e70bc981320 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1581320) #26 0x00007e70bc109144 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd09144) #27 0x00007e70bc0380ae clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc380ae) #28 0x00007e70be10140c clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d0140c) #29 0x000059b5f0856813 (/usr/bin/clangd+0x3e7813) #30 0x000059b5f08f51e4 (/usr/bin/clangd+0x4861e4) #31 0x000059b5f08f4c3a (/usr/bin/clangd+0x485c3a) #32 0x000059b5f08f1400 (/usr/bin/clangd+0x482400) #33 0x000059b5f08f0f76 (/usr/bin/clangd+0x481f76) #34 0x000059b5f0a571d1 (/usr/bin/clangd+0x5e81d1) #35 0x00007e70b269ca94 start_thread ./nptl/pthread_create.c:447:8 #36 0x00007e70b2729c3c clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0 Signalled during AST worker action: Build AST Filename: source/visualsort.cppm Directory: /home/ilobilo/Desktop/projects/visualsort Command Line: /usr/lib/llvm-19/bin/clang -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Werror -O3 -std=c++23 -stdlib=libc++ -cxx-isystem/usr/lib/llvm-19/include/c++/v1 -I /home/ilobilo/.xmake/packages/f/ftxui/v5.0.0/bfd210310c974f0bbb9fbb748ac7aae4/include -I /home/ilobilo/.xmake/packages/f/fmt/11.0.0/920a4073dd28420f9c79ca3b805f8e91/include -DNDEBUG -fmodule-file=visualsort:bubblesort=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort-bubblesort.pcm -fmodule-file=std=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/std.pcm -fmodule-file=visualsort:sorter=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort-sorter.pcm -x c++-module -fmodule-output=build/.gens/visualsort/linux/x86_64/release/rules/bmi/cache/modules/40bb7f91/visualsort.pcm -o build/.objs/visualsort/linux/x86_64/release/source/visualsort.cppm.o -resource-dir=/usr/lib/llvm-19/lib/clang/19 -- /home/ilobilo/Desktop/projects/visualsort/source/visualsort.cppm Version: 1 ```

@HighCommander4
Copy link
Collaborator

First thing to do here is probably to wait for #66462 to merge and see if that fixes it.

@HighCommander4 HighCommander4 changed the title clangd 19 crashing clangd 19 crashing when using C++20 Modules Jul 4, 2024
@ilobilo ilobilo closed this as completed Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants