[LLVMbugs] [Bug 23945] New: Compiler crash in incorrect, heavily-templated code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 25 06:46:24 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23945
Bug ID: 23945
Summary: Compiler crash in incorrect, heavily-templated code
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: michael at ensslin.cc
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14518
--> https://llvm.org/bugs/attachment.cgi?id=14518&action=edit
tar.xz archive of test.cpp and the crash reproducers.
Take this failed attempt at a template specialization:
#include <tuple>
template<typename T, typename ... Ts>
struct S {
template<typename ... Us>
void foo(std::tuple<T, Us ..., Ts ...>, Us ...) {
}
};
template<typename T, typename ... Ts>
void S<T, Ts ...>::foo<>(std::tuple<T, Ts ...>) {}
clang++{3.5, 3.6, 3.7} -std=c++{11, 14} will crash and print a stacktrace,
albeit slightly different ones (as is to be expected, I guess).
I'm using the compiler versions from the Debian Sid repository.
$ clang++-3.7 -std=c++14 -c test.cpp
test.cpp:13:20: error: cannot specialize a member of an unspecialized template
void S<T, Ts ...>::foo<>(std::tuple<T, Ts ...>) {}
^ ~~
0 libLLVM-3.7.so.1 0x00007f53beeb49b5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 libLLVM-3.7.so.1 0x00007f53beeb3fc9
2 libpthread.so.0 0x00007f53bda158d0
3 clang 0x00000000012b3168
clang::ASTContext::getSubstTemplateTypeParmType(clang::TemplateTypeParmType
const*, clang::QualType) const + 200
4 clang 0x0000000000e7d30f
5 clang 0x0000000000e8a8f9
6 clang 0x0000000000e8b955
7 clang 0x0000000000e954e5
8 clang 0x0000000000e9927f
9 clang 0x0000000000e8a769
10 clang 0x0000000000e8a95f
11 clang 0x0000000000e8b955
12 clang 0x0000000000e8ba43
clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName) + 83
13 clang 0x0000000000e9e9d8
clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
clang::MultiLevelTemplateArgumentList const&, int, llvm::Optional<unsigned
int>, bool) + 88
14 clang 0x0000000000e9f1ba
15 clang 0x0000000000e9f577
16 clang 0x0000000000ea0cc0
clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName, clang::CXXRecordDecl*, unsigned int) + 1872
17 clang 0x0000000000ea81e2
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 114
Stack dump:
0. Program arguments: /usr/lib/llvm-3.7/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-main-file-name test.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.25
-dwarf-column-info -coverage-file /tmp/llvmbug/test.cpp -resource-dir
/usr/lib/llvm-3.7/bin/../lib/clang/3.7.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-3.7/bin/../lib/clang/3.7.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir /tmp/llvmbug -ferror-limit 19 -fmessage-length 190
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o test.o -x c++ test.cpp
1. test.cpp:13:49: current parser token '{'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 3.7.0-svn239806-1+b1 (trunk) (based on LLVM 3.7.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
The crash reproducers, as suggested by the error message, are attached (but
they're rather bloated, due to my #include <tuple>, which I didn't manage to
remove, so I suggest not using them.
--
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/20150625/aa5cb573/attachment.html>
More information about the llvm-bugs
mailing list