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

deserialization crash on checking concept-related TemplateParameters #46134

Closed
hokein opened this issue Jul 21, 2020 · 3 comments
Closed

deserialization crash on checking concept-related TemplateParameters #46134

hokein opened this issue Jul 21, 2020 · 3 comments
Labels
bugzilla Issues migrated from bugzilla c++20

Comments

@hokein
Copy link
Collaborator

hokein commented Jul 21, 2020

Bugzilla Link 46790
Resolution FIXED
Resolved on Sep 01, 2020 16:57
Version trunk
OS All
Blocks #46070
CC @aaronpuchert,@zmodem,@zygoloid,@saarraz
Fixed by commit(s) 73c12bd a45dd85

Extended Description

$ cat /tmp/t2.cpp

#ifndef HEADER
#define HEADER

template <typename T, typename U>
concept not_same_as = true;

template
struct subrange {
template <not_same_as R>
subrange(R) requires (Kind == 0);

template <not_same_as R>
subrange(R) requires (Kind != 0);
};

template
subrange(R) -> subrange<42>;

int main() {
int c[3];
subrange s(c);
}

$ ./bin/clang -cc1 -emit-pch -std=c++2a -o /tmp/pch /tmp/t2.cpp
$ ./bin/clang -cc1 -include-pch /tmp/pch -std=c++2a -emit-llvm -o - /tmp/t2.cpp

LEASE 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: ./bin/clang -cc1 -include-pch /tmp/pch -std=c++2a -emit-llvm -o - /tmp/t2.cpp

  1.  <eof> parser at end of file
    

#​0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
#​1 llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:69:18
#​2 SignalHandler(int) llvm-project/llvm/lib/Support/Unix/Signals.inc:396:3
#​3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14110)
#​4 clang::ConceptReference::getNamedConcept() const llvm-project/clang/include/clang/AST/ASTConcept.h:155:12
#​5 isSameTemplateParameter(clang::NamedDecl const*, clang::NamedDecl const*) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:2919:17
#​6 isSameTemplateParameterList(clang::ASTContext const&, clang::TemplateParameterList const*, clang::TemplateParameterList const*) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:3010:10
#​7 clang::ASTDeclReader::findExisting(clang::NamedDecl*) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:3498:13
#​8 clang::ASTDeclReader::FindExistingResult::operator clang::NamedDecl*() const llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:238:44
#​9 void clang::ASTDeclReader::mergeRedeclarableclang::RedeclarableTemplateDecl(clang::Redeclarableclang::RedeclarableTemplateDecl, clang::ASTDeclReader::RedeclarableResult&, unsigned int) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:2505:31
#​10 clang::ASTDeclReader::VisitRedeclarableTemplateDecl(clang::RedeclarableTemplateDecl
) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:2090:18
#​11 clang::ASTDeclReader::VisitFunctionTemplateDecl(clang::FunctionTemplateDecl*) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:2236:18
#​12 clang::ASTDeclReader::Visit(clang::Decl*) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:527:34
#​13 llvm::isa_impl<clang::DeclContext, clang::Decl, void>::doit(clang::Decl const&) llvm-project/llvm/include/llvm/Support/Casting.h:58:12
#​14 llvm::isa_impl_cl<clang::DeclContext, clang::Decl const*>::doit(clang::Decl const*) llvm-project/llvm/include/llvm/Support/Casting.h:105:12
#​15 llvm::isa_impl_wrap<clang::DeclContext, clang::Decl const*, clang::Decl const*>::doit(clang::Decl const* const&) llvm-project/llvm/include/llvm/Support/Casting.h:131:12
#​16 llvm::isa_impl_wrap<clang::DeclContext, clang::Decl* const, clang::Decl const*>::doit(clang::Decl* const&) llvm-project/llvm/include/llvm/Support/Casting.h:121:12
#​17 bool llvm::isa<clang::DeclContext, clang::Decl*>(clang::Decl* const&) llvm-project/llvm/include/llvm/Support/Casting.h:142:10
#​18 llvm::cast_retty<clang::DeclContext, clang::Decl*>::ret_type llvm::dyn_cast<clang::DeclContext, clang::Decl>(clang::Decl*) llvm-project/llvm/include/llvm/Support/Casting.h:345:10
#​19 clang::ASTReader::ReadDeclRecord(unsigned int) llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:4061:18
#​20 clang::ASTReader::GetDecl(unsigned int) llvm-project/clang/lib/Serialization/ASTReader.cpp:7424:9
#​21 clang::ASTReader::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName) llvm-project/clang/lib/Serialization/ASTReader.cpp:7614:37
#​22 clang::DeclContext::lookup(clang::DeclarationName) const llvm-project/clang/lib/AST/DeclBase.cpp:1699:60
#​23 clang::ASTReader::CompleteRedeclChain(clang::Decl const*) llvm-project/clang/lib/Serialization/ASTReader.cpp:7191:62
#​24 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::get(clang::Decl const*) llvm-project/clang/include/clang/AST/ExternalASTSource.h:449:23
#​25 clang::Redeclarableclang::FunctionDecl::DeclLink::getPrevious(clang::FunctionDecl const*) const llvm-project/clang/include/clang/AST/Redeclarable.h:134:62
#​26 clang::Redeclarableclang::FunctionDecl::getNextRedeclaration() const llvm-project/clang/include/clang/AST/Redeclarable.h:190:23
#​27 clang::Redeclarableclang::FunctionDecl::redecl_iterator::operator++() llvm-project/clang/include/clang/AST/Redeclarable.h:271:34
#​28 clang::FunctionDecl::isDefined(clang::FunctionDecl const*&) const llvm-project/clang/lib/AST/Decl.cpp:2871:15
#​29 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4615:58
#​30 clang::FunctionDecl::isDefined() const llvm-project/clang/include/clang/AST/Decl.h:2035:12
#​31 clang::Sema::PerformPendingInstantiations(bool) llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6074:23
#​32 llvm::TimeTraceScope::~TimeTraceScope() llvm-project/llvm/include/llvm/Support/TimeProfiler.h:86:9
#​33 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) llvm-project/clang/lib/Sema/Sema.cpp:957:3
#​34 clang::Sema::ActOnEndOfTranslationUnit() llvm-project/clang/lib/Sema/Sema.cpp:998:9
#​35 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, bool) llvm-project/clang/lib/Parse/Parser.cpp:657:15
#​36 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) llvm-project/clang/lib/Parse/Parser.cpp:555:26
#​37 clang::ParseAST(clang::Sema&, bool, bool) llvm-project/clang/lib/Parse/ParseAST.cpp:0:25
#​38 clang::FrontendAction::Execute() llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:10
#else
#endif

@hokein
Copy link
Collaborator Author

hokein commented Jul 30, 2020

Fixed 73c12bd.

I keep it opened for cherry pick it in 11 branch.

@zmodem
Copy link
Collaborator

zmodem commented Aug 3, 2020

Fixed
https://github.com/llvm/llvm-project/commit/
73c12bd.

I keep it opened for cherry pick it in 11 branch.

Pushed to 11.x as a45dd85. Thanks!

@aaronpuchert
Copy link
Member

*** Bug #45700 has been marked as a duplicate of this bug. ***

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++20
Projects
None yet
Development

No branches or pull requests

3 participants