[LLVMbugs] [Bug 18744] New: Clang crashes when instantiating a function template which uses decltype
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Feb 5 11:39:05 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18744
Bug ID: 18744
Summary: Clang crashes when instantiating a function template
which uses decltype
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: be.gentner at googlemail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang crashes when instantiating a function template which uses decltype as the
return type and inside the function a decltype typedef. The error only appears
when you compile with PCH (precompiled header).
Stackdump:
0 libLLVM-3.3.so 0x0000003920951672 llvm::sys::PrintStackTrace(_IO_FILE*) +
50
1 libLLVM-3.3.so 0x00000039209514a4
2 libpthread.so.0 0x00000039c860f750
3 clang 0x00000000010fd16c
4 clang 0x00000000010fd2c2
5 clang 0x000000000062a973
6 clang 0x00000000010feb60
7 clang 0x00000000010ffcb2
clang::Stmt::Profile(llvm::FoldingSetNodeID&, clang::ASTContext const&, bool)
const + 2962
8 clang 0x0000000000ff1974
clang::ASTContext::getDecltypeType(clang::Expr*, clang::QualType) const + 100
9 clang 0x00000000007308a8 clang::ASTReader::readTypeRecord(unsigned
int) + 4728
10 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
11 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
12 clang 0x000000000074d337
13 clang 0x000000000072fc23 clang::ASTReader::readTypeRecord(unsigned
int) + 1523
14 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
15 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
16 clang 0x000000000075d53b
clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 75
17 clang 0x000000000075d67f
clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 15
18 clang 0x000000000075dbc0
clang::ASTDeclReader::VisitFunctionDecl(clang::FunctionDecl*) + 192
19 clang 0x000000000076415d clang::ASTDeclReader::Visit(clang::Decl*)
+ 445
20 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
21 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
22 clang 0x000000000075b134
clang::ASTDeclReader::VisitDecl(clang::Decl*) + 100
23 clang 0x000000000075b7a1
clang::ASTDeclReader::VisitNamedDecl(clang::NamedDecl*) + 17
24 clang 0x000000000075d501
clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 17
25 clang 0x000000000075d67f
clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 15
26 clang 0x000000000075ef66
clang::ASTDeclReader::VisitVarDecl(clang::VarDecl*) + 182
27 clang 0x000000000075f37f
clang::ASTDeclReader::VisitParmVarDecl(clang::ParmVarDecl*) + 15
28 clang 0x00000000007640bd clang::ASTDeclReader::Visit(clang::Decl*)
+ 285
29 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
30 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
31 clang 0x00000000007765a4
clang::ASTStmtReader::VisitDeclRefExpr(clang::DeclRefExpr*) + 356
32 clang 0x000000000077888b
clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) + 2875
33 clang 0x0000000000730899 clang::ASTReader::readTypeRecord(unsigned
int) + 4713
34 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
35 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
36 clang 0x000000000074d337
37 clang 0x0000000000730c33 clang::ASTReader::readTypeRecord(unsigned
int) + 5635
38 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
39 clang 0x0000000000764040 clang::ASTDeclReader::Visit(clang::Decl*)
+ 160
40 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
41 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
42 clang 0x0000000000730c1f clang::ASTReader::readTypeRecord(unsigned
int) + 5615
43 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
44 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
45 clang 0x000000000074d337
46 clang 0x000000000072fd6e clang::ASTReader::readTypeRecord(unsigned
int) + 1854
47 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
48 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
49 clang 0x000000000074d337
50 clang 0x000000000073226d
clang::ASTReader::GetTypeSourceInfo(clang::serialization::ModuleFile&,
llvm::SmallVector<unsigned long, 64u> const&, unsigned int&) + 45
51 clang 0x0000000000752879
clang::ASTDeclReader::ReadCXXDefinitionData(clang::CXXRecordDecl::DefinitionData&,
llvm::SmallVector<unsigned long, 64u> const&, unsigned int&) + 1641
52 clang 0x000000000075c49e
clang::ASTDeclReader::VisitCXXRecordDecl(clang::CXXRecordDecl*) + 174
53 clang 0x000000000076422d clang::ASTDeclReader::Visit(clang::Decl*)
+ 653
54 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
55 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
56 clang 0x0000000000730fce clang::ASTReader::readTypeRecord(unsigned
int) + 6558
57 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
58 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
59 clang 0x000000000076d0fb
clang::ASTStmtReader::VisitExpr(clang::Expr*) + 75
60 clang 0x00000000007746f9
clang::ASTStmtReader::VisitLambdaExpr(clang::LambdaExpr*) + 25
61 clang 0x000000000077888b
clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) + 2875
62 clang 0x000000000072cefb
clang::ASTReader::GetExternalDeclStmt(unsigned long) + 107
63 clang 0x00000000010508d6
clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const + 118
64 clang 0x0000000000c76da8
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 184
65 clang 0x0000000000c76ada
clang::Sema::PerformPendingInstantiations(bool) + 490
66 clang 0x00000000009bfa9a clang::Sema::ActOnEndOfTranslationUnit()
+ 3194
67 clang 0x000000000092fc76
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 486
68 clang 0x0000000000927deb clang::ParseAST(clang::Sema&, bool, bool)
+ 571
69 clang 0x00000000007c8da2 clang::CodeGenAction::ExecuteAction() +
50
70 clang 0x000000000066bdf9 clang::FrontendAction::Execute() + 169
71 clang 0x000000000064bc65
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 309
72 clang 0x000000000063538c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1724
73 clang 0x000000000062ea10 cc1_main(char const**, char const**, char
const*, void*) + 1072
74 clang 0x000000000062d041 main + 7841
75 libc.so.6 0x00000039c7e21d65 __libc_start_main + 245
76 clang 0x000000000062d915
Clang invocation:
/usr/bin/clang -cc1 -triple x86_64-redhat-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name CCampaignHandler.cpp
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.23.2 -g -D
""M_BIN_DIR=\"/usr/local/bin\""" -D ""M_DATA_DIR=\"/usr/local/share/vcmi\""" -D
""M_LIB_DIR=\"/usr/local/lib64/vcmi\""" -D "vcmi_EXPORTS" -Wall -Wextra
-Wpointer-arith -Wno-switch -Wno-sign-compare -Wno-unused-parameter
-Wuninitialized -Wno-overloaded-virtual -Wno-mismatched-tags -std=c++0x
-fdeprecated-macro -ferror-limit 19 -fmessage-length 0 -mstackrealign
-fobjc-runtime=gcc -fobjc-default-synthesize-properties -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -backend-option -vectorize-loops -x c++
CCampaignHandler-DqmNlF.cpp
Template function:
//Returns iterator to the element for which the value of ValueFunction is
maximal
template<class ForwardRange, class ValueFunction>
auto maxElementByFun(const ForwardRange& rng, ValueFunction vf) ->
decltype(std::begin(rng))
{
typedef decltype(*std::begin(rng)) ElemType;
return boost::max_element(rng, [&] (ElemType lhs, ElemType rhs) -> bool
{
return vf(lhs) < vf(rhs);
});
}
If no ElemType typedef is used, Clang doesn't crash.
--
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/20140205/ce564b80/attachment.html>
More information about the llvm-bugs
mailing list