[LLVMbugs] [Bug 13429] New: clang crashes when trying to compile code with lambda function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 21 08:34:50 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13429

             Bug #: 13429
           Summary: clang crashes when trying to compile code with lambda
                    function
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jsstark at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


compiling the following snippet:

int main()
{
vector<int> v;
for_each(v.begin(), v.end(), [](int a){});
return 0;
}

results in a compiler crash:

0  clang             0x0000000109a67422 _ZL15PrintStackTracePv + 34
1  clang             0x0000000109a678a9 _ZL13SignalHandleri + 553
2  libsystem_c.dylib 0x00007fff9475dcfa _sigtramp + 26
3  libsystem_c.dylib 0x00007ff384604820 _sigtramp + 18446744021900094272
4  clang             0x0000000108c2b490
clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation,
clang::ASTMultiPtr<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool) +
640
5  clang             0x0000000108c0f37c
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 1372
6  clang             0x0000000108c0ab72
clang::Parser::ParseCastExpression(bool, bool, bool&, bool) + 6898
7  clang             0x0000000108c09032
clang::Parser::ParseAssignmentExpression() + 114
8  clang             0x0000000108c08fa1 clang::Parser::ParseExpression() + 17
9  clang             0x0000000108c5e4ae
clang::Parser::ParseExprStatement(clang::ParsedAttributes&) + 46
10 clang             0x0000000108c08a3c
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 1564
11 clang             0x0000000108c07d59
clang::Parser::ParseCompoundStatementBody(bool) + 409
12 clang             0x0000000108c07b4f
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 159
13 clang             0x0000000108bffd3e
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 1870
14 clang             0x0000000108bde971
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1041
15 clang             0x0000000108bf9ebb
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 667
16 clang             0x0000000108bf9b69
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 393
17 clang             0x0000000108bc9c7f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2671
18 clang             0x0000000108bc9199
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 249
19 clang             0x0000000108bac0a5 clang::ParseAST(clang::Sema&, bool) +
325
20 clang             0x0000000108baabd7 clang::CodeGenAction::ExecuteAction() +
855
21 clang             0x0000000108b7d13f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
22 clang             0x0000000108b7bdcb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2683
23 clang             0x0000000108b6e5ce cc1_main(char const**, char const**,
char const*, void*) + 5086
24 clang             0x0000000108b48dd8 main + 648
25 clang             0x0000000108b48b44 start + 52
26 clang             0x0000000000000030 start + 18446744069268534560
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-apple-macosx10.7.4
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
clang_bug.cpp -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 128.2 -resource-dir
/usr/bin/../lib/clang/3.1 -fmodule-cache-path
/var/folders/0y/4_kjhk8930z0fv2v0t8zrdd00000gn/T/clang-module-cache
-stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/Users/john/Develop/Temp -ferror-limit 19 -fmessage-length 191 -stack-protector
1 -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/0y/4_kjhk8930z0fv2v0t8zrdd00000gn/T/clang_bug-AnicKX.o -x c++
clang_bug.cpp 
1.    clang_bug.cpp:9:50: current parser token ')'
2.    clang_bug.cpp:7:1: parsing function body 'main'
3.    clang_bug.cpp:7:1: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault: 11
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
http://developer.apple.com/bugreporter/ and include command line arguments and
all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/0y/4_kjhk8930z0fv2v0t8zrdd00000gn/T/clang_bug-fdCxTl.ii
clang: note: diagnostic msg:
/var/folders/0y/4_kjhk8930z0fv2v0t8zrdd00000gn/T/clang_bug-fdCxTl.sh
raptor:Temp john$ clang++ --version
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list