[LLVMbugs] [Bug 12068] New: clang crashes on hasAnyTypeDependentArguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 22 15:44:36 PST 2012


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

             Bug #: 12068
           Summary: clang crashes on hasAnyTypeDependentArguments
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sylvestre at debian.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8091
  --> http://llvm.org/bugs/attachment.cgi?id=8091
Preprocessed source

With the code:
-------
#include <string>
#include <vector>
#include <algorithm>

class A
{
        struct B
        {
            std::string p;
        };

        std::vector<B> C;

    void findIter();

};

void A::findIter()
{
        find_if(
            C.begin(), C.end(), 
            [&](B &D)
            {
                return D.p == "";
            }
        );
}
----
clang crashes with:
plop.cpp:24:24: error: use of undeclared identifier 'D'
                return D.p == "";
                       ^
0  libLLVM-3.0.so.1 0x00007f77746c3adf
1  libLLVM-3.0.so.1 0x00007f77746c4081
2  libpthread.so.0  0x00007f777362b030
3  clang            0x0000000000d33d39
clang::Expr::hasAnyTypeDependentArguments(clang::Expr**, unsigned int) + 41
4  clang            0x000000000095f463
clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation,
clang::ASTMultiPtr<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool) +
483
5  clang            0x0000000000827879
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3145
6  clang            0x00000000008218cb clang::Parser::ParseCastExpression(bool,
bool, bool&, bool) + 203
7  clang            0x000000000082411e clang::Parser::ParseCastExpression(bool,
bool, bool) + 30
8  clang            0x0000000000824a0f
clang::Parser::ParseAssignmentExpression() + 31
9  clang            0x00000000008257d9 clang::Parser::ParseExpression() + 9
10 clang            0x00000000007e7e72
clang::Parser::ParseExprStatement(clang::ParsedAttributes&) + 50
11 clang            0x00000000007e4698
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 2616
12 clang            0x00000000007e1291
clang::Parser::ParseCompoundStatementBody(bool) + 417
13 clang            0x00000000007e1f7a
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 138
14 clang            0x00000000007fba6c
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 1116
15 clang            0x00000000008093b2
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 610
16 clang            0x00000000007f7655
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 149
17 clang            0x00000000007f7cc6
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 678
18 clang            0x00000000007f988d
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2685
19 clang            0x00000000007f9df7
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 167
20 clang            0x00000000007d13cd clang::ParseAST(clang::Sema&, bool) +
269
21 clang            0x00000000006b9f33 clang::CodeGenAction::ExecuteAction() +
51
22 clang            0x00000000005c137f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 319
23 clang            0x00000000005a9c3a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1114
24 clang            0x00000000005a1954 cc1_main(char const**, char const**,
char const*, void*) + 804
25 clang            0x00000000005a0304 main + 596
26 libc.so.6        0x00007f7772709ead __libc_start_main + 253
27 clang            0x00000000005a14d9
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -disable-free -disable-llvm-verifier -main-file-name plop.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 -g -coverage-file history/o/3setdata.o -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 -O2 -Wall
-std=c++0x -fdeprecated-macro -ferror-limit 19 -fmessage-length 191
-fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
history/o/3setdata.o -x c++ plop.cpp 
1.    plop.cpp:26:9: current parser token ')'
2.    plop.cpp:19:1: parsing function body 'findIter'
3.    plop.cpp:19: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
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/plop/G9kKJa.ii

while gcc does not complain.

-- 
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