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

clang -std=c++23 -fmodules -stdlib=libc++ test.cpp failed #102745

Open
zyp2005 opened this issue Aug 10, 2024 · 5 comments
Open

clang -std=c++23 -fmodules -stdlib=libc++ test.cpp failed #102745

zyp2005 opened this issue Aug 10, 2024 · 5 comments
Labels
clang:modules C++20 modules and Clang Header Modules confirmed Verified by a second party crash-on-invalid

Comments

@zyp2005
Copy link

zyp2005 commented Aug 10, 2024

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	/usr/bin/../include/c++/v1/__system_error/error_condition.h:28:1: current parser token 'template'
1.	/usr/bin/../include/c++/v1/__system_error/error_condition.h:26:1 <Spelling=/usr/bin/../include/c++/v1/__config:884:39>: parsing namespace 'std'
 #0 0x00007c79adfc4d90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.18.1+0x7c4d90)
 #1 0x00007c79adfc1d4d (/usr/lib/libLLVM.so.18.1+0x7c1d4d)
 #2 0x00007c79ad24c1d0 (/usr/lib/libc.so.6+0x3d1d0)
 #3 0x00007c79b7886ed8 llvm::SmallVectorBase<unsigned int>::size() const /usr/include/llvm/ADT/SmallVector.h:91:32
 #4 0x00007c79b7886ed8 llvm::SmallVectorTemplateCommon<std::pair<clang::Decl*, clang::FunctionDecl*>, void>::end() /usr/include/llvm/ADT/SmallVector.h:282:41
 #5 0x00007c79b7886ed8 llvm::SmallVectorTemplateBase<std::pair<clang::Decl*, clang::FunctionDecl*>, true>::push_back(std::pair<clang::Decl*, clang::FunctionDecl*>) /usr/include/llvm/ADT/SmallVector.h:576:46
 #6 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorTemplateBase<std::pair<clang::Decl*, clang::FunctionDecl*>, true>::growAndEmplaceBack<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:569:14
 #7 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorImpl<std::pair<clang::Decl*, clang::FunctionDecl*>>::emplace_back<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:952:38
 #8 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorImpl<std::pair<clang::Decl*, clang::FunctionDecl*>>::emplace_back<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:950:0
 #9 0x00007c79b7886ed8 std::pair<std::pair<clang::Decl*, clang::FunctionDecl*>*, bool> llvm::MapVector<clang::Decl*, clang::FunctionDecl*, llvm::SmallDenseMap<clang::Decl*, unsigned int, 4u, llvm::DenseMapInfo<clang::Decl*, void>, llvm::detail::DenseMapPair<clang::Decl*, unsigned int>>, llvm::SmallVector<std::pair<clang::Decl*, clang::FunctionDecl*>, 4u>>::try_emplace<clang::FunctionDecl*>(clang::Decl*&&, clang::FunctionDecl*&&) /usr/include/llvm/ADT/MapVector.h:133:26
#10 0x00007c79b7886ed8 llvm::MapVector<clang::Decl*, clang::FunctionDecl*, llvm::SmallDenseMap<clang::Decl*, unsigned int, 4u, llvm::DenseMapInfo<clang::Decl*, void>, llvm::detail::DenseMapPair<clang::Decl*, unsigned int>>, llvm::SmallVector<std::pair<clang::Decl*, clang::FunctionDecl*>, 4u>>::insert(std::pair<clang::Decl*, clang::FunctionDecl*>&&) /usr/include/llvm/ADT/MapVector.h:145:23
#11 0x00007c79b7886ed8 void clang::ASTDeclReader::attachPreviousDeclImpl<clang::FunctionDecl>(clang::ASTReader&, clang::Redeclarable<clang::FunctionDecl>*, clang::Decl*, clang::Decl*) /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReaderDecl.cpp:3660:48
#12 0x00007c79b78a2b71 clang::ASTReader::finishPendingActions() /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:9571:28
#13 0x00007c79b78ade9e clang::ASTReader::FinishedDeserializing() /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:10090:3
#14 0x00007c79b78ade9e clang::ExternalASTSource::Deserializing::~Deserializing() /usr/src/debug/clang/clang-18.1.8.src/include/clang/AST/ExternalASTSource.h:86:36
#15 0x00007c79b78ade9e clang::ASTReader::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName) /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:7981:1
#16 0x00007c79b6298853 clang::DeclContext::lookup(clang::DeclarationName) const /usr/src/debug/clang/clang-18.1.8.src/lib/AST/DeclBase.cpp:1822:60
#17 0x00007c79b6c663ca LookupDirect /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaLookup.cpp:1124:23
#18 0x00007c79b6c698de clang::Sema::LookupQualifiedName(clang::LookupResult&, clang::DeclContext*, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaLookup.cpp:2448:3
#19 0x00007c79b6a4823e clang::Sema::ActOnStartNamespaceDef(clang::Scope*, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributesView const&, clang::UsingDirectiveDecl*&, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaDeclCXX.cpp:11658:28
#20 0x00007c79b5fbc4f0 clang::PrettyDeclStackTraceEntry::PrettyDeclStackTraceEntry(clang::ASTContext&, clang::Decl*, clang::SourceLocation, char const*) /usr/src/debug/clang/clang-18.1.8.src/include/clang/AST/PrettyDeclStackTrace.h:38:54
#21 0x00007c79b5fbc4f0 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:236:72
#22 0x00007c79b5fdd00f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDecl.cpp:1928:0
#23 0x00007c79b60694cb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:1018:32
#24 0x00007c79b5fbb3ff clang::AttributePool::~AttributePool() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Sema/ParsedAttr.h:705:41
#25 0x00007c79b5fbb3ff clang::ParsedAttributes::~ParsedAttributes() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Sema/ParsedAttr.h:935:7
#26 0x00007c79b5fbb3ff clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:264:5
#27 0x00007c79b5fbc579 clang::Parser::ParseScope::Exit() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Parse/Parser.h:1161:24
#28 0x00007c79b5fbc579 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:243:22
#29 0x00007c79b5fdd10c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDecl.cpp:1940:0
#30 0x00007c79b60694cb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:1018:32
#31 0x00007c79b606a06b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:760:36
#32 0x00007c79b5f8cfb8 clang::ParseAST(clang::Sema&, bool, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseAST.cpp:162:69
#33 0x00007c79b7a583d1 clang::FrontendAction::Execute() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/FrontendAction.cpp:1069:21
#34 0x00007c79b79f9017 llvm::Error::getPtr() const /usr/include/llvm/Support/Error.h:279:0
#35 0x00007c79b79f9017 llvm::Error::operator bool() /usr/include/llvm/Support/Error.h:239:0
#36 0x00007c79b79f9017 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/CompilerInstance.cpp:1057:0
#37 0x00007c79b79f9549 clang::FrontendAction::~FrontendAction() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/FrontendAction.cpp:149:0
#38 0x00007c79b79f9549 clang::ASTFrontendAction::~ASTFrontendAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendAction.h:243:0
#39 0x00007c79b79f9549 clang::GenerateModuleAction::~GenerateModuleAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendActions.h:116:0
#40 0x00007c79b79f9549 clang::GenerateModuleFromModuleMapAction::~GenerateModuleFromModuleMapAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendActions.h:142:0
#41 0x00007c79b79f9549 operator() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/CompilerInstance.cpp:1278:0
#42 0x00007c79b79f9549 callback_fn<compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void(clang::CompilerInstance&)>, llvm::function_ref<void(clang::CompilerInstance&)>)::<lambda()> > /usr/include/llvm/ADT/STLFunctionalExtras.h:45:0
#43 0x00007c79adea8d3a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM.so.18.1+0x6a8d3a)
#44 0x00007c79adea8df0 (/usr/lib/libLLVM.so.18.1+0x6a8df0)
#45 0x00007c79adea87ab (/usr/lib/libLLVM.so.18.1+0x6a87ab)
#46 0x00007c79ad2a339d (/usr/lib/libc.so.6+0x9439d)
#47 0x00007c79ad32849c (/usr/lib/libc.so.6+0x11949c)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 18.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-a7e820.cpp
clang: note: diagnostic msg: /tmp/test-a7e820.cache
clang: note: diagnostic msg: /tmp/test-a7e820.sh
clang: note: diagnostic msg: 

********************
@philnik777
Copy link
Contributor

Could you provide the files listed at the bottom?

@github-actions github-actions bot added clang Clang issues not falling into any other category libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. labels Aug 10, 2024
@EugeneZelenko EugeneZelenko added clang:modules C++20 modules and Clang Header Modules incomplete Issue not complete (e.g. missing a reproducer, build arguments, etc.) and removed clang Clang issues not falling into any other category labels Aug 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 10, 2024

@llvm/issue-subscribers-clang-modules

Author: zyp2005 (zyp2005)

``` PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. /usr/bin/../include/c++/v1/__system_error/error_condition.h:28:1: current parser token 'template' 1. /usr/bin/../include/c++/v1/__system_error/error_condition.h:26:1 <Spelling=/usr/bin/../include/c++/v1/__config:884:39>: parsing namespace 'std' #0 0x00007c79adfc4d90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.18.1+0x7c4d90) #1 0x00007c79adfc1d4d (/usr/lib/libLLVM.so.18.1+0x7c1d4d) #2 0x00007c79ad24c1d0 (/usr/lib/libc.so.6+0x3d1d0) #3 0x00007c79b7886ed8 llvm::SmallVectorBase<unsigned int>::size() const /usr/include/llvm/ADT/SmallVector.h:91:32 #4 0x00007c79b7886ed8 llvm::SmallVectorTemplateCommon<std::pair<clang::Decl*, clang::FunctionDecl*>, void>::end() /usr/include/llvm/ADT/SmallVector.h:282:41 #5 0x00007c79b7886ed8 llvm::SmallVectorTemplateBase<std::pair<clang::Decl*, clang::FunctionDecl*>, true>::push_back(std::pair<clang::Decl*, clang::FunctionDecl*>) /usr/include/llvm/ADT/SmallVector.h:576:46 #6 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorTemplateBase<std::pair<clang::Decl*, clang::FunctionDecl*>, true>::growAndEmplaceBack<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:569:14 #7 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorImpl<std::pair<clang::Decl*, clang::FunctionDecl*>>::emplace_back<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:952:38 #8 0x00007c79b7886ed8 std::pair<clang::Decl*, clang::FunctionDecl*>& llvm::SmallVectorImpl<std::pair<clang::Decl*, clang::FunctionDecl*>>::emplace_back<std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>, std::tuple<clang::FunctionDecl*&&>>(std::piecewise_construct_t const&, std::tuple<clang::Decl*&&>&&, std::tuple<clang::FunctionDecl*&&>&&) /usr/include/llvm/ADT/SmallVector.h:950:0 #9 0x00007c79b7886ed8 std::pair<std::pair<clang::Decl*, clang::FunctionDecl*>*, bool> llvm::MapVector<clang::Decl*, clang::FunctionDecl*, llvm::SmallDenseMap<clang::Decl*, unsigned int, 4u, llvm::DenseMapInfo<clang::Decl*, void>, llvm::detail::DenseMapPair<clang::Decl*, unsigned int>>, llvm::SmallVector<std::pair<clang::Decl*, clang::FunctionDecl*>, 4u>>::try_emplace<clang::FunctionDecl*>(clang::Decl*&&, clang::FunctionDecl*&&) /usr/include/llvm/ADT/MapVector.h:133:26 #10 0x00007c79b7886ed8 llvm::MapVector<clang::Decl*, clang::FunctionDecl*, llvm::SmallDenseMap<clang::Decl*, unsigned int, 4u, llvm::DenseMapInfo<clang::Decl*, void>, llvm::detail::DenseMapPair<clang::Decl*, unsigned int>>, llvm::SmallVector<std::pair<clang::Decl*, clang::FunctionDecl*>, 4u>>::insert(std::pair<clang::Decl*, clang::FunctionDecl*>&&) /usr/include/llvm/ADT/MapVector.h:145:23 #11 0x00007c79b7886ed8 void clang::ASTDeclReader::attachPreviousDeclImpl<clang::FunctionDecl>(clang::ASTReader&, clang::Redeclarable<clang::FunctionDecl>*, clang::Decl*, clang::Decl*) /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReaderDecl.cpp:3660:48 #12 0x00007c79b78a2b71 clang::ASTReader::finishPendingActions() /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:9571:28 #13 0x00007c79b78ade9e clang::ASTReader::FinishedDeserializing() /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:10090:3 #14 0x00007c79b78ade9e clang::ExternalASTSource::Deserializing::~Deserializing() /usr/src/debug/clang/clang-18.1.8.src/include/clang/AST/ExternalASTSource.h:86:36 #15 0x00007c79b78ade9e clang::ASTReader::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName) /usr/src/debug/clang/clang-18.1.8.src/lib/Serialization/ASTReader.cpp:7981:1 #16 0x00007c79b6298853 clang::DeclContext::lookup(clang::DeclarationName) const /usr/src/debug/clang/clang-18.1.8.src/lib/AST/DeclBase.cpp:1822:60 #17 0x00007c79b6c663ca LookupDirect /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaLookup.cpp:1124:23 #18 0x00007c79b6c698de clang::Sema::LookupQualifiedName(clang::LookupResult&, clang::DeclContext*, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaLookup.cpp:2448:3 #19 0x00007c79b6a4823e clang::Sema::ActOnStartNamespaceDef(clang::Scope*, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributesView const&, clang::UsingDirectiveDecl*&, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Sema/SemaDeclCXX.cpp:11658:28 #20 0x00007c79b5fbc4f0 clang::PrettyDeclStackTraceEntry::PrettyDeclStackTraceEntry(clang::ASTContext&, clang::Decl*, clang::SourceLocation, char const*) /usr/src/debug/clang/clang-18.1.8.src/include/clang/AST/PrettyDeclStackTrace.h:38:54 #21 0x00007c79b5fbc4f0 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:236:72 #22 0x00007c79b5fdd00f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDecl.cpp:1928:0 #23 0x00007c79b60694cb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:1018:32 #24 0x00007c79b5fbb3ff clang::AttributePool::~AttributePool() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Sema/ParsedAttr.h:705:41 #25 0x00007c79b5fbb3ff clang::ParsedAttributes::~ParsedAttributes() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Sema/ParsedAttr.h:935:7 #26 0x00007c79b5fbb3ff clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:264:5 #27 0x00007c79b5fbc579 clang::Parser::ParseScope::Exit() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Parse/Parser.h:1161:24 #28 0x00007c79b5fbc579 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDeclCXX.cpp:243:22 #29 0x00007c79b5fdd10c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseDecl.cpp:1940:0 #30 0x00007c79b60694cb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:1018:32 #31 0x00007c79b606a06b clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/Parser.cpp:760:36 #32 0x00007c79b5f8cfb8 clang::ParseAST(clang::Sema&, bool, bool) /usr/src/debug/clang/clang-18.1.8.src/lib/Parse/ParseAST.cpp:162:69 #33 0x00007c79b7a583d1 clang::FrontendAction::Execute() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/FrontendAction.cpp:1069:21 #34 0x00007c79b79f9017 llvm::Error::getPtr() const /usr/include/llvm/Support/Error.h:279:0 #35 0x00007c79b79f9017 llvm::Error::operator bool() /usr/include/llvm/Support/Error.h:239:0 #36 0x00007c79b79f9017 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/CompilerInstance.cpp:1057:0 #37 0x00007c79b79f9549 clang::FrontendAction::~FrontendAction() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/FrontendAction.cpp:149:0 #38 0x00007c79b79f9549 clang::ASTFrontendAction::~ASTFrontendAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendAction.h:243:0 #39 0x00007c79b79f9549 clang::GenerateModuleAction::~GenerateModuleAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendActions.h:116:0 #40 0x00007c79b79f9549 clang::GenerateModuleFromModuleMapAction::~GenerateModuleFromModuleMapAction() /usr/src/debug/clang/clang-18.1.8.src/include/clang/Frontend/FrontendActions.h:142:0 #41 0x00007c79b79f9549 operator() /usr/src/debug/clang/clang-18.1.8.src/lib/Frontend/CompilerInstance.cpp:1278:0 #42 0x00007c79b79f9549 callback_fn<compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void(clang::CompilerInstance&)>, llvm::function_ref<void(clang::CompilerInstance&)>)::<lambda()> > /usr/include/llvm/ADT/STLFunctionalExtras.h:45:0 #43 0x00007c79adea8d3a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM.so.18.1+0x6a8d3a) #44 0x00007c79adea8df0 (/usr/lib/libLLVM.so.18.1+0x6a8df0) #45 0x00007c79adea87ab (/usr/lib/libLLVM.so.18.1+0x6a87ab) #46 0x00007c79ad2a339d (/usr/lib/libc.so.6+0x9439d) #47 0x00007c79ad32849c (/usr/lib/libc.so.6+0x11949c) clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) clang version 18.1.8 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin clang: note: diagnostic msg: ********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-a7e820.cpp
clang: note: diagnostic msg: /tmp/test-a7e820.cache
clang: note: diagnostic msg: /tmp/test-a7e820.sh
clang: note: diagnostic msg:



</details>

@zyp2005
Copy link
Author

zyp2005 commented Aug 10, 2024

Here are the preprocessed source

# 1 "test.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 469 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.cpp" 2
import std;

using namespace std;
int main() {

  std::cout << "Hello, Would!\n";

  return 0;
}

@zyp2005
Copy link
Author

zyp2005 commented Aug 10, 2024

I use clang -std=c++23 -fmodules -stdlib=libc++ test.cpp to compile

@EugeneZelenko EugeneZelenko removed the incomplete Issue not complete (e.g. missing a reproducer, build arguments, etc.) label Aug 10, 2024
@philnik777 philnik777 removed the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 11, 2024
@ChuanqiXu9
Copy link
Member

-fmodules is not intented to use standard named modules but clang header modules. Please see https://libcxx.llvm.org/Modules.html

But crash is always a bug. So this issue report is valid.

@AaronBallman AaronBallman added crash-on-invalid confirmed Verified by a second party labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules confirmed Verified by a second party crash-on-invalid
Projects
None yet
Development

No branches or pull requests

6 participants