<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Crash while compiling lambdas within a template function"
href="http://llvm.org/bugs/show_bug.cgi?id=22499">22499</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash while compiling lambdas within a template function
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>public.gourdin@laposte.net
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Below is the crash report. The code source that causes the crash:
template <typename T>
void ggo_fill_brush(ggo_packer2d_abc<T> & packer,
const ggo_brush_abc<T> & brush,
const ggo_sampler_abc & sampler)
{
ggo_rect_float bounding_rect =
ggo_rect_float::from_left_right_bottom_top(-0.5, packer.get_width() - 0.5,
-0.5, packer.get_height() - 0.5);
packer.for_each_pixel([&](int x, int y, int width, int height)
{
T color(0);
sampler.sample_pixel(x, y, [&](float x_f, float y_f)
{
color += brush.get_color(x_f, y_f, bounding_rect, width, height);
});
color /= sampler.get_samples_count();
packer.pack(x, y, color);
});
}
The crash does not occur when I comment the body of the inner lambda (ie. if I
comment the line 'color += brush.get_color...').
0 libLLVM-3.4.so.1 0x40f8a50f llvm::sys::PrintStackTrace(_IO_FILE*) + 47
1 libLLVM-3.4.so.1 0x40f8a77f
2 libLLVM-3.4.so.1 0x40f8a2ec
3 0x40022400 __kernel_sigreturn + 0
4 clang 0x08dfa5b0
clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&,
clang::VarDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 96
5 clang 0x08d77f28
clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 168
6 clang 0x08d7e193 clang::VarDecl::checkInitIsICE() const + 275
7 clang 0x087f5ff1 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool, bool) + 1953
8 clang 0x0889bfbc
clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>) + 124
9 clang 0x0861ee38 clang::Parser::ParseExprStatement() + 136
10 clang 0x0861df4b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3211
11 clang 0x0861e10e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 142
12 clang 0x0862231e clang::Parser::ParseCompoundStatementBody(bool)
+ 1902
13 clang 0x08600558
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) +
2760
14 clang 0x08601bee clang::Parser::ParseLambdaExpression() + 462
15 clang 0x085ea833 clang::Parser::ParseCastExpression(bool, bool,
bool&, clang::Parser::TypeCastState) + 7779
16 clang 0x085ebcd4 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) + 68
17 clang 0x085ebdb0
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 80
18 clang 0x085edad0
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, void
(clang::Sema::*)(clang::Scope*, clang::Expr*, llvm::ArrayRef<clang::Expr*>),
clang::Expr*) + 192
19 clang 0x085eec5c
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3612
20 clang 0x085e8a70 clang::Parser::ParseCastExpression(bool, bool,
bool&, clang::Parser::TypeCastState) + 160
21 clang 0x085ebcd4 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) + 68
22 clang 0x085ebdb0
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 80
23 clang 0x085ebe90
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 48
24 clang 0x0861edf9 clang::Parser::ParseExprStatement() + 73
25 clang 0x0861df4b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3211
26 clang 0x0861e10e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 142
27 clang 0x0862231e clang::Parser::ParseCompoundStatementBody(bool)
+ 1902
28 clang 0x08600558
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) +
2760
29 clang 0x08601bee clang::Parser::ParseLambdaExpression() + 462
30 clang 0x085ea833 clang::Parser::ParseCastExpression(bool, bool,
bool&, clang::Parser::TypeCastState) + 7779
31 clang 0x085ebcd4 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) + 68
32 clang 0x085ebdb0
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 80
33 clang 0x085edad0
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, void
(clang::Sema::*)(clang::Scope*, clang::Expr*, llvm::ArrayRef<clang::Expr*>),
clang::Expr*) + 192
34 clang 0x085eec5c
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3612
35 clang 0x085e8a70 clang::Parser::ParseCastExpression(bool, bool,
bool&, clang::Parser::TypeCastState) + 160
36 clang 0x085ebcd4 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) + 68
37 clang 0x085ebdb0
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 80
38 clang 0x085ebe90
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 48
39 clang 0x0861edf9 clang::Parser::ParseExprStatement() + 73
40 clang 0x0861df4b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3211
41 clang 0x0861e10e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 142
42 clang 0x0862231e clang::Parser::ParseCompoundStatementBody(bool)
+ 1902
43 clang 0x08624a62
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 210
44 clang 0x085b9176
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1606
45 clang 0x086298fe
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 3262
46 clang 0x0862a711
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 993
47 clang 0x0862aa43
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 131
48 clang 0x085d0dea
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 634
49 clang 0x085bb682
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 514
50 clang 0x085bbf4d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 189
51 clang 0x085b209f clang::ParseAST(clang::Sema&, bool, bool) + 303
52 clang 0x0829ec0f clang::ASTFrontendAction::ExecuteAction() + 127
53 clang 0x0841c8d1 clang::CodeGenAction::ExecuteAction() + 33
54 clang 0x0829f338 clang::FrontendAction::Execute() + 168
55 clang 0x082794e2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 258
56 clang 0x08262d8e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1598
57 clang 0x0825e3fe cc1_main(char const**, char const**, char
const*, void*) + 1294
58 clang 0x0825c958 main + 8072
59 libc.so.6 0x41b3ba83 __libc_start_main + 243
60 clang 0x0825d301
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple i386-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
ggo_fill.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.24 -g -coverage-file
/home/guillaume/ggp/ggo2d/src/ggo_fill.o -resource-dir
/usr/bin/../lib/clang/3.4 -D GGO_DEBUG -D LINUX -I src -I src/io -I src/color
-I src/brush -I src/sampling -I src/data_packing -I src/paint -I
src/space_partitionning -I ../ggokernel/include -internal-isystem
/usr/include//c++/4.8 -internal-isystem /usr/include//c++/4.8/i386-linux-gnu
-internal-isystem /usr/include//c++/4.8/backward -internal-isystem
/usr/include//i386-linux-gnu/c++/4.8 -internal-isystem
/usr/bin/../lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/i686-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/i686-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/i686-linux-gnu/4.8/../../../../include/i686-linux-gnu/c++/4.8
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.4/include -internal-externc-isystem
/usr/bin/../lib/gcc/i686-linux-gnu/4.8/include -internal-externc-isystem
/usr/include/i386-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/guillaume/ggp/ggo2d -ferror-limit 19
-fmessage-length 106 -pthread -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o src/ggo_fill.o -x c++ src/ggo_fill.cpp
1. src/ggo_fill.cpp:228:5: current parser token '}'
2. src/ggo_fill.cpp:218:1: parsing function body 'ggo_fill_brush'
3. src/ggo_fill.cpp:218:1: in compound statement ('{}')
4. src/ggo_fill.cpp:221:25: lambda expression parsing
5. src/ggo_fill.cpp:222:3: in compound statement ('{}')
6. src/ggo_fill.cpp:225:32: lambda expression parsing
7. src/ggo_fill.cpp:226:5: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: i386-pc-linux-gnu
Thread model: posix</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>