<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 --- - Segfault after "use of undeclared identifier" in Lambda"
href="http://llvm.org/bugs/show_bug.cgi?id=16312">16312</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segfault after "use of undeclared identifier" in Lambda
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.0
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>xavierholt@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=10672" name="attach_10672" title="A simple .cpp file that causes this crash.">attachment 10672</a> <a href="attachment.cgi?id=10672&action=edit" title="A simple .cpp file that causes this crash.">[details]</a></span>
A simple .cpp file that causes this crash.
In brief: clang++ claims that a lambda parameter is undeclared, then
segfaults.
I hit this when trying to compile some more complicated code, but was able to
strip it down to a very minimal test case (see attached).
Full console output follows:
holt@Michaela ~ $ uname --all
Linux Michaela 3.5.0-32-generic #53-Ubuntu SMP Wed May 29 20:23:04 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
holt@Michaela ~ $ clang++ --std=c++11 clang-bug.cpp -v
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
"/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name clang-bug.cpp
-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.22
-momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.0
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/include/c++/4.6 -internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu
-internal-isystem /usr/include/c++/4.6/backward -internal-isystem
/usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 168 -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/clang-bug-IXW0GR.o -x c++
clang-bug.cpp
clang -cc1 version 3.0 based upon llvm 3.0 hosted on x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring nonexistent directory "/usr/include/c++/4.6//x86_64-linux-gnu/64"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.6
/usr/include/c++/4.6/x86_64-linux-gnu
/usr/include/c++/4.6/backward
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
/usr/include/clang/3.0/include/
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/
End of search list.
clang-bug.cpp:15:16: error: use of undeclared identifier 'i'
std::cout << i << '\n';
^
0 libLLVM-3.0.so.1 0x00007fdb5942266f
1 libLLVM-3.0.so.1 0x00007fdb59422ad9
2 libpthread.so.0 0x00007fdb583c4cb0
3 clang 0x0000000000d1d32e
clang::Expr::hasAnyTypeDependentArguments(clang::Expr**, unsigned int) + 14
4 clang 0x00000000009499d3
clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation,
clang::ASTMultiPtr<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool) +
483
5 clang 0x0000000000812d09
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3145
6 clang 0x000000000080cd3b clang::Parser::ParseCastExpression(bool,
bool, bool&, bool) + 203
7 clang 0x000000000080f59e clang::Parser::ParseCastExpression(bool,
bool, bool) + 30
8 clang 0x000000000080fe8f
clang::Parser::ParseAssignmentExpression() + 31
9 clang 0x0000000000810c59 clang::Parser::ParseExpression() + 9
10 clang 0x00000000007d35f2
clang::Parser::ParseExprStatement(clang::ParsedAttributes&) + 50
11 clang 0x00000000007cfe18
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 2616
12 clang 0x00000000007cca11
clang::Parser::ParseCompoundStatementBody(bool) + 417
13 clang 0x00000000007cd6fa
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 138
14 clang 0x00000000007e708c
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 1116
15 clang 0x00000000007f4a42
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 610
16 clang 0x00000000007e2c75
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 149
17 clang 0x00000000007e32e6
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 678
18 clang 0x00000000007e4ead
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2685
19 clang 0x00000000007e5417
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 167
20 clang 0x00000000007bcbfd clang::ParseAST(clang::Sema&, bool) +
269
21 clang 0x00000000006a6253 clang::CodeGenAction::ExecuteAction() +
51
22 clang 0x00000000005adc7f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 319
23 clang 0x000000000059653a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1114
24 clang 0x000000000058e1c4 cc1_main(char const**, char const**,
char const*, void*) + 820
25 clang 0x000000000058cb3c main + 620
26 libc.so.6 0x00007fdb57afd76d __libc_start_main + 237
27 clang 0x000000000058dd39
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
clang-bug.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.0
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/include/c++/4.6 -internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu
-internal-isystem /usr/include/c++/4.6/backward -internal-isystem
/usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 168 -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/clang-bug-IXW0GR.o -x c++
clang-bug.cpp
1. clang-bug.cpp:16:3: current parser token ')'
2. clang-bug.cpp:13:1: parsing function body 'main'
3. clang-bug.cpp:13:1: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/clang-bug-fmuJvd.ii</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>