[llvm-bugs] [Bug 33092] New: Clang asserts in CodeGen with a lambda default argument function in a template
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 18 13:31:56 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33092
Bug ID: 33092
Summary: Clang asserts in CodeGen with a lambda default
argument function in a template
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: erik.pilkington at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Clang trunk (and dating back to 3.8) crashes on the following, compiled with
-std=c++14:
template<typename F> int algo(F fn) { return fn(); }
template<class X> void g(int n) {
int bef(int i = []{ return 1; }());
algo([=]{return n+bef();});
}
int main() { g<int>(0); }
With the stack trace:
Assertion failed: ((isGenericMethod || ((*I)->isVariablyModifiedType() ||
(*I).getNonReferenceType()->isObjCRetainableType() || getContext()
.getCanonicalType((*I).getNonReferenceType()) .getTypePtr() == getContext()
.getCanonicalType((*Arg)->getType()) .getTypePtr())) && "type mismatch in call
argument!"), function EmitCallArgs, file
/Users/erikpilkington/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h, line
3725.
0 clang-5.0 0x000000010d77e3fc
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1 clang-5.0 0x000000010d77e979
PrintStackTraceSignalHandler(void*) + 25
2 clang-5.0 0x000000010d77a8c9 llvm::sys::RunSignalHandlers() +
425
3 clang-5.0 0x000000010d77ed02 SignalHandler(int) + 354
4 libsystem_platform.dylib 0x00007fffb64b4bba _sigtramp + 26
5 libsystem_platform.dylib 000000000000000000 _sigtramp + 1236579424
6 libsystem_c.dylib 0x00007fffb633b420 abort + 129
7 libsystem_c.dylib 0x00007fffb6302893 basename_r + 0
8 clang-5.0 0x000000010dd1c28b void
clang::CodeGen::CodeGenFunction::EmitCallArgs<clang::FunctionProtoType>(clang::CodeGen::CallArgList&,
clang::FunctionProtoType const*,
llvm::iterator_range<clang::Stmt::ConstExprIterator>,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder) + 843
9 clang-5.0 0x000000010dd1b642
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*) + 4306
10 clang-5.0 0x000000010dd19fe8
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 776
11 clang-5.0 0x000000010dd6b5e3 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) + 163
12 clang-5.0 0x000000010dd65f2b
clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 2939
13 clang-5.0 0x000000010dd5efa9 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) + 73
14 clang-5.0 0x000000010dd70fb8 (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*) + 104
15 clang-5.0 0x000000010dd67448 (anonymous
namespace)::ScalarExprEmitter::VisitBinAdd(clang::BinaryOperator const*) + 40
16 clang-5.0 0x000000010dd654b3
clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 259
17 clang-5.0 0x000000010dd5efa9 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) + 73
18 clang-5.0 0x000000010dd5ef0d
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 189
19 clang-5.0 0x000000010de7edc4
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 948
20 clang-5.0 0x000000010de7bda1
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 993
21 clang-5.0 0x000000010de8bea8
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 136
22 clang-5.0 0x000000010defba52
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 146
23 clang-5.0 0x000000010defc62a
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1418
24 clang-5.0 0x000000010df24b1e
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 574
25 clang-5.0 0x000000010df1c9cc
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 588
26 clang-5.0 0x000000010df12669
clang::CodeGen::CodeGenModule::EmitDeferred() + 1097
27 clang-5.0 0x000000010df126c5
clang::CodeGen::CodeGenModule::EmitDeferred() + 1189
28 clang-5.0 0x000000010df126c5
clang::CodeGen::CodeGenModule::EmitDeferred() + 1189
29 clang-5.0 0x000000010df10b06
clang::CodeGen::CodeGenModule::Release() + 54
30 clang-5.0 0x000000010e0e9be6 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) + 166
31 clang-5.0 0x000000010dee5dcc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 220
32 clang-5.0 0x000000010fba8186 clang::ParseAST(clang::Sema&,
bool, bool) + 1238
33 clang-5.0 0x000000010e5cce95
clang::ASTFrontendAction::ExecuteAction() + 485
34 clang-5.0 0x000000010dee53c5
clang::CodeGenAction::ExecuteAction() + 5509
35 clang-5.0 0x000000010e5cbf20 clang::FrontendAction::Execute()
+ 112
36 clang-5.0 0x000000010e4f39e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 2278
37 clang-5.0 0x000000010e66797c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 5836
38 clang-5.0 0x000000010a4280d2 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 4914
39 clang-5.0 0x000000010a4177ee
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) + 622
40 clang-5.0 0x000000010a4149e9 main + 4457
41 libdyld.dylib 0x00007fffb62a7255 start + 1
42 libdyld.dylib 0x0000000000000034 start + 1238732256
--
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/20170518/e1d92887/attachment.html>
More information about the llvm-bugs
mailing list