[llvm-bugs] [Bug 40608] New: unqualified name lookup crash
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Feb 5 08:02:43 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40608
Bug ID: 40608
Summary: unqualified name lookup crash
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: asynts at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 21435
--> https://bugs.llvm.org/attachment.cgi?id=21435&action=edit
fail.cc / fail.sh
The following is what I am trying to do:
template <typename T> struct A {
template <bool U> void a() {}
};
template <typename T> struct B : A<T> {
void b() {
this->template a<true>(); // works
}
};
I attempted to shorten this (the following isn't valid syntax):
template <typename T> struct A {
template <bool U> void a() {}
};
template <typename T> struct B : A<T> {
void b() {
using A<T>::a;
a<true>(); // crash
}
};
Clang crashed in response:
$ cat > fail.cc <<EOF
> template <typename T> struct A {
> template <bool U> void a() {}
> };
>
> template <typename T> struct B : A<T> {
> void b() {
> using A<T>::a;
> a<true>(); // crash
> }
> };
> EOF
$ clang++ -c fail.cc
Stack dump:
0. Program arguments: /usr/lib/llvm-7/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name fail.cc -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -coverage-notes-file
/tmp/tmp.zZiTls2yVR/fail.gcno -resource-dir /usr/lib/llvm-7/lib/clang/7.0.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward
-internal-isystem /usr/include/clang/7.0.1/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /tmp/tmp.zZiTls2yVR -ferror-limit 19
-fmessage-length 190 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o fail.o -x c++ fail.cc
-faddrsig
1. fail.cc:8:11: current parser token '>'
2. fail.cc:5:23: parsing struct/union/class body 'B'
3. fail.cc:6:12: parsing function body 'B::b'
4. fail.cc:6:12: in compound statement ('{}')
#0 0x00007f6ef376ec2f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cec2f)
#1 0x00007f6ef376d160 llvm::sys::RunSignalHandlers()
(/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cd160)
#2 0x00007f6ef376ef42 (/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cef42)
#3 0x00007f6ef67c7670 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12670)
#4 0x00000000016f3e27
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, clang::TemplateArgumentListInfo&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&, bool)
(/usr/lib/llvm-7/bin/clang+0x16f3e27)
#5 0x00000000016f2a40 clang::Sema::CheckTemplateIdType(clang::TemplateName,
clang::SourceLocation, clang::TemplateArgumentListInfo&)
(/usr/lib/llvm-7/bin/clang+0x16f2a40)
#6 0x00000000016f5c26
clang::Sema::ActOnTemplateIdType(clang::CXXScopeSpec&, clang::SourceLocation,
clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*,
clang::SourceLocation, clang::SourceLocation,
llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation,
bool, bool) (/usr/lib/llvm-7/bin/clang+0x16f5c26)
#7 0x000000000114e9b8
clang::Parser::AnnotateTemplateIdToken(clang::OpaquePtr<clang::TemplateName>,
clang::TemplateNameKind, clang::CXXScopeSpec&, clang::SourceLocation,
clang::UnqualifiedId&, bool) (/usr/lib/llvm-7/bin/clang+0x114e9b8)
#8 0x00000000010c1cb8 clang::Parser::TryAnnotateName(bool,
std::unique_ptr<clang::CorrectionCandidateCallback,
std::default_delete<clang::CorrectionCandidateCallback> >)
(/usr/lib/llvm-7/bin/clang+0x10c1cb8)
#9 0x000000000113d8d2
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-7/bin/clang+0x113d8d2)
#10 0x000000000113d5f9
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*)
(/usr/lib/llvm-7/bin/clang+0x113d5f9)
#11 0x0000000001144735 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/lib/llvm-7/bin/clang+0x1144735)
#12 0x0000000001145095
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/lib/llvm-7/bin/clang+0x1145095)
#13 0x00000000010c7b5b
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
(/usr/lib/llvm-7/bin/clang+0x10c7b5b)
#14 0x00000000010c6cfe
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
(/usr/lib/llvm-7/bin/clang+0x10c6cfe)
#15 0x00000000010f057d
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/usr/lib/llvm-7/bin/clang+0x10f057d)
#16 0x00000000010ee58d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-7/bin/clang+0x10ee58d)
#17 0x00000000010d23c5
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/lib/llvm-7/bin/clang+0x10d23c5)
#18 0x000000000114ace4
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib/llvm-7/bin/clang+0x114ace4)
#19 0x000000000114a747
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib/llvm-7/bin/clang+0x114a747)
#20 0x000000000114a171
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib/llvm-7/bin/clang+0x114a171)
#21 0x00000000010d1a71
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-7/bin/clang+0x10d1a71)
#22 0x00000000010bcff7
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-7/bin/clang+0x10bcff7)
#23 0x00000000010bc8de
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-7/bin/clang+0x10bc8de)
#24 0x00000000010b83f7 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-7/bin/clang+0x10b83f7)
#25 0x0000000000ad246f clang::FrontendAction::Execute()
(/usr/lib/llvm-7/bin/clang+0xad246f)
#26 0x0000000000a93768
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-7/bin/clang+0xa93768)
#27 0x0000000000b60906
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-7/bin/clang+0xb60906)
#28 0x00000000006aa014 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-7/bin/clang+0x6aa014)
#29 0x00000000006a84b7 main (/usr/lib/llvm-7/bin/clang+0x6a84b7)
#30 0x00007f6ef28e309b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#31 0x00000000006a5ada _start (/usr/lib/llvm-7/bin/clang+0x6a5ada)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.1-6 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
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/fail-f2354f.cpp
clang: note: diagnostic msg: /tmp/fail-f2354f.sh
clang: note: diagnostic msg:
********************
I've added /tmp/fail-f2354f.cpp and /tmp/fail-f2354f.sh as attachment.
I am running clang 7.0.1, but putting that snippet into https://godbolt.org/
caused a crash as well (in trunk). I don't want to provide a link because I am
worried that might cause trouble on their servers.
--
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/20190205/4c03b3ef/attachment-0001.html>
More information about the llvm-bugs
mailing list