[llvm-bugs] [Bug 46790] New: deserialization crash on checking concept-related TemplateParameters

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 21 08:19:15 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46790

            Bug ID: 46790
           Summary: deserialization crash on checking concept-related
                    TemplateParameters
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hokein at google.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

$ cat /tmp/t2.cpp

#ifndef HEADER
#define HEADER

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

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

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

template <typename R>
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::mergeRedeclarable<clang::RedeclarableTemplateDecl>(clang::Redeclarable<clang::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::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl
const*) const llvm-project/clang/include/clang/AST/Redeclarable.h:134:62
#26 clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
llvm-project/clang/include/clang/AST/Redeclarable.h:190:23
#27 clang::Redeclarable<clang::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::OpaquePtr<clang::DeclGroupRef>&,
bool) llvm-project/clang/lib/Parse/Parser.cpp:657:15
#36
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200721/5ef324cc/attachment.html>


More information about the llvm-bugs mailing list