| Issue |
53012
|
| Summary |
ICE on invalid: clang::Sema::AttachBaseSpecifiers: Stack dump
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
trofi
|
Here is reduced reproducer from ICE I initially got when tried to build `mold` with `libc++`. Not sure if original code was completely valid:
```c++
template < class> struct _Lazy {
struct __extract_key_first_tag
template < class _Key>
struct __can_extract_key : _Key,
__extract_key_first_tagtypename
```
```
$ clang++ -c bug.cpp
bug.cpp:2:33: error: expected ';' after struct
struct __extract_key_first_tag
^
;
bug.cpp:5:30: error: unknown class name '__extract_key_first_tagtypename'; did you mean '__extract_key_first_tag'?
__extract_key_first_tagtypename
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__extract_key_first_tag
bug.cpp:2:10: note: '__extract_key_first_tag' declared here
struct __extract_key_first_tag
^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /<<NIX>>/clang-13.0.0/bin/clang++ @/dev/fd/63
1. <eof> parser at end of file
2. bug.cpp:1:19: parsing struct/union/class body '_Lazy'
3. bug.cpp:4:3: parsing struct/union/class body '_Lazy::__can_extract_key'
#0 0x00007f5da5a6adb0 PrintStackTraceSignalHandler(void*) (//<<NIX>>/llvm-13.0.0-lib/lib/libLLVM-13.so+0xd29db0)
#1 0x00007f5da5a68c3c llvm::sys::CleanupOnSignal(unsigned long) (//<<NIX>>/llvm-13.0.0-lib/lib/libLLVM-13.so+0xd27c3c)
#2 0x00007f5da596fba8 CrashRecoverySignalHandler(int) (//<<NIX>>/llvm-13.0.0-lib/lib/libLLVM-13.so+0xc2eba8)
#3 0x00007f5daf36cee0 __restore_rt (/<<NIX>>/glibc-2.33-59/lib/libpthread.so.0+0x12ee0)
#4 0x00007f5dacd72fdb NoteIndirectBases(clang::ASTContext&, llvm::SmallPtrSet<clang::QualType, 4u>&, clang::QualType const&) (.isra.0) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x15cdfdb)
#5 0x00007f5dacda3692 clang::Sema::AttachBaseSpecifiers(clang::CXXRecordDecl*, llvm::MutableArrayRef<clang::CXXBaseSpecifier*>) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x15fe692)
#6 0x00007f5dacda405b clang::Sema::ActOnBaseSpecifiers(clang::Decl*, llvm::MutableArrayRef<clang::CXXBaseSpecifier*>) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x15ff05b)
#7 0x00007f5dac3fcf0b clang::Parser::ParseBaseClause(clang::Decl*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc57f0b)
#8 0x00007f5dac4036d9 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5e6d9)
#9 0x00007f5dac404f8b clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5ff8b)
#10 0x00007f5dac3e3187 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc3e187)
#11 0x00007f5dac4000db clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5b0db)
#12 0x00007f5dac491cdf clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xceccdf)
#13 0x00007f5dac498884 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xcf3884)
#14 0x00007f5dac40101d clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5c01d)
#15 0x00007f5dac402cbb clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5dcbb)
#16 0x00007f5dac4032c6 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5e2c6)
#17 0x00007f5dac404f8b clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc5ff8b)
#18 0x00007f5dac3e3187 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc3e187)
#19 0x00007f5dac490b78 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xcebb78)
#20 0x00007f5dac498884 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xcf3884)
#21 0x00007f5dac498b0b clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xcf3b0b)
#22 0x00007f5dac3e830f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc4330f)
#23 0x00007f5dac4ab4bb clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xd064bb)
#24 0x00007f5dac4acc1a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xd07c1a)
#25 0x00007f5dac4ad085 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xd08085)
#26 0x00007f5dac3bdac3 clang::ParseAST(clang::Sema&, bool, bool) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0xc18ac3)
#27 0x00007f5dadf60cf9 clang::FrontendAction::Execute() (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x27bbcf9)
#28 0x00007f5dadeebab9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x2746ab9)
#29 0x00007f5dadfdf51f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x283a51f)
#30 0x00000000004164d0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/<<NIX>>/clang-13.0.0/bin/clang+++0x4164d0)
#31 0x00000000004138f9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/<<NIX>>/clang-13.0.0/bin/clang+++0x4138f9)
#32 0x00007f5dadbad1f5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x24081f5)
#33 0x00007f5da596fcb3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (//<<NIX>>/llvm-13.0.0-lib/lib/libLLVM-13.so+0xc2ecb3)
#34 0x00007f5dadbad56c clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x240856c)
#35 0x00007f5dadb80a47 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x23dba47)
#36 0x00007f5dadb81459 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x23dc459)
#37 0x00007f5dadb91281 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/<<NIX>>/clang-13.0.0-lib/lib/libclang-cpp.so.13+0x23ec281)
#38 0x000000000041167d main (/<<NIX>>/clang-13.0.0/bin/clang+++0x41167d)
#39 0x00007f5da4871780 __libc_start_main (/<<NIX>>/glibc-2.33-59/lib/libc.so.6+0x27780)
#40 0x000000000041327a _start (/<<NIX>>/clang-13.0.0/bin/clang+++0x41327a)
clang-13: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /<<NIX>>/clang-13.0.0/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /run/user/1000/bug-2dc2a1.cpp
clang-13: note: diagnostic msg: /run/user/1000/bug-2dc2a1.sh
clang-13: note: diagnostic msg:
```
I thin stack dump is unexpected. Attaching both:
- [bug-2dc2a1.cpp](https://github.com/llvm/llvm-project/files/7816655/bug-2dc2a1.cpp.txt)
- [bug-2dc2a1.sh](https://github.com/llvm/llvm-project/files/7816656/bug-2dc2a1.sh.txt)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs