[LLVMbugs] [Bug 17740] New: Clang crash on template instantiation
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Oct 30 11:05:03 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17740
Bug ID: 17740
Summary: Clang crash on template instantiation
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: fragmentshaders at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 11450
--> http://llvm.org/bugs/attachment.cgi?id=11450&action=edit
source code to reproduce the crash.
Clang crashes on the attached source code.
clang++ -std=c++11 tmc.cpp -fsyntax-only
Stacktrace:
Assertion failed: (isa<LabelDecl>(D) && "declaration not instantiated in this
scope"), function findInstantiationOf, file
/Users/hanm/Desktop/projects/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp,
line 2784.
0 clang 0x000000010d74d868
llvm::sys::PrintStackTrace(__sFILE*) + 40
1 clang 0x000000010d74dd64 SignalHandler(int) + 548
2 libsystem_platform.dylib 0x00007fff873c75aa _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2026080880
4 clang 0x000000010d74db26 abort + 22
5 clang 0x000000010d74db01 __assert_rtn + 81
6 clang 0x000000010c3ba6a7
clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) + 663
7 clang 0x000000010c3d3321
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 385
8 clang 0x000000010c3d72c5
clang::Sema::FindInstantiatedContext(clang::SourceLocation,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 69
9 clang 0x000000010c3d37d7
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 1591
10 clang 0x000000010c3bcb5a (anonymous
namespace)::TemplateInstantiator::TransformDecl(clang::SourceLocation,
clang::Decl*) + 314
11 clang 0x000000010c3c44e4 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformMemberExpr(clang::MemberExpr*) +
228
12 clang 0x000000010c3b7bab clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2267
13 clang 0x000000010c3cba9d clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) + 77
14 clang 0x000000010c3b7684 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 948
15 clang 0x000000010c3b6d08 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 104
16 clang 0x000000010c3c97cf clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) + 159
17 clang 0x000000010c3b6c67
clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList
const&) + 71
18 clang 0x000000010c3df596
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1910
19 clang 0x000000010c3e0860
clang::Sema::PerformPendingInstantiations(bool) + 592
20 clang 0x000000010c3df3ac
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1420
21 clang 0x000000010c3e0860
clang::Sema::PerformPendingInstantiations(bool) + 592
22 clang 0x000000010c3df771
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2385
23 clang 0x000000010c3e0860
clang::Sema::PerformPendingInstantiations(bool) + 592
24 clang 0x000000010c0e7167
clang::Sema::ActOnEndOfTranslationUnit() + 455
25 clang 0x000000010c0a97d0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 176
26 clang 0x000000010c02d476 clang::ParseAST(clang::Sema&,
bool, bool) + 438
27 clang 0x000000010bd8db56 clang::FrontendAction::Execute()
+ 134
28 clang 0x000000010bd6965d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 973
29 clang 0x000000010bd31920
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4256
30 clang 0x000000010bd29743 cc1_main(char const**, char
const**, char const*, void*) + 835
31 clang 0x000000010bd2dc42 main + 1138
32 libdyld.dylib 0x00007fff8b5195fd start + 1
33 libdyld.dylib 0x000000000000002b start + 1957587503
Stack dump:
0. Program arguments:
/Users/hanm/Desktop/projects/llvm_build/Release+Asserts/bin/clang -cc1 -triple
x86_64-apple-macosx10.9.0 -fsyntax-only -disable-free -main-file-name tmc.cpp
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 224.1 -resource-dir
/Users/hanm/Desktop/projects/llvm_build/Release+Asserts/bin/../lib/clang/3.4
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/Users/hanm/Desktop/projects/llvm_build/Release+Asserts/bin -ferror-limit 19
-fmessage-length 91 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x
c++ tmc.cpp
1. <eof> parser at end of file
2. tmc.cpp:19:9: instantiating function definition 'func'
3. tmc.cpp:14:9: instantiating function definition 'bar'
4. tmc.cpp:25:14: instantiating function definition 'operator()'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 193653)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
g++ / VC11 seems happy about the same code.
Note... if i use the clang shipped with OS X I got a different error.
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
tmc.cpp:26:13: error: 'C::func(<lambda at
tmc.cpp:34:13>)::Struct::operator()()::Struct::mFunction' is not a member
of class
'Struct'
mFunction();
^
tmc.cpp:15:23: note: in instantiation of member function 'C::func(<lambda at
tmc.cpp:34:13>)::Struct::operator()' requested here
foo([&function](){function();});
^
tmc.cpp:30:5: note: in instantiation of function template specialization
'C::bar<Struct>'
requested here
bar(Struct(function));
^
tmc.cpp:34:5: note: in instantiation of function template specialization
'C::func<<lambda
at tmc.cpp:34:13> >' requested here
C::func([](){});
^
--
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/20131030/4a27d059/attachment.html>
More information about the llvm-bugs
mailing list