[LLVMbugs] [Bug 14120] New: compiler crash on invalid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 18 07:24:27 PDT 2012


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

             Bug #: 14120
           Summary: compiler crash on invalid code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rizsotto.mailinglist at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9382
  --> http://llvm.org/bugs/attachment.cgi?id=9382
gdb backtrace

struct Functor {
    static void operator()(int & i) { ++i; }
};

void test_1() {
    int i = 0;
    Functor()(i);
}

this simle code make the compiler crash with the following message:

$ clang -cc1 -ast-dump ./test.cpp 
./test.cpp:4:17: error: overloaded 'operator()' cannot be a static member
function
    static void operator()(int & i) {
                ^
clang:
/home/laszlona/Programming/llvm-svn.src/tools/clang/lib/AST/DeclCXX.cpp:1474:
clang::QualType clang::CXXMethodDecl::getThisType(clang::ASTContext&) const:
Assertion `isInstance() && "No 'this' for static methods!"' failed.
0  clang           0x00000000013010bf
1  clang           0x0000000001301549
2  libpthread.so.0 0x00007f7141880fe0
3  libc.so.6       0x00007f7140cdd925 gsignal + 53
4  libc.so.6       0x00007f7140cdf0d8 abort + 328
5  libc.so.6       0x00007f7140cd66a2
6  libc.so.6       0x00007f7140cd6752
7  clang           0x0000000001db45a5
clang::CXXMethodDecl::getThisType(clang::ASTContext&) const + 341
8  clang           0x00000000018edc74
clang::Sema::PerformObjectArgumentInitialization(clang::Expr*,
clang::NestedNameSpecifier*, clang::NamedDecl*, clang::CXXMethodDecl*) + 84
9  clang           0x000000000190191c
clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*,
clang::SourceLocation, clang::Expr**, unsigned int, clang::SourceLocation) +
2700
10 clang           0x0000000001863c1f clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1471
11 clang           0x00000000015b63f0
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 4096
12 clang           0x00000000015af53b clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 203
13 clang           0x00000000015b191d clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 29
14 clang           0x00000000015b2d8f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 31
15 clang           0x00000000015b3dc9
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
16 clang           0x00000000015e1660 clang::Parser::ParseExprStatement() + 48
17 clang           0x00000000015dc9ef
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2079
18 clang           0x00000000015dcb6d
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 141
19 clang           0x00000000015dd6c7
clang::Parser::ParseCompoundStatementBody(bool) + 1815
20 clang           0x00000000015def7d
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 141
21 clang           0x000000000158a8e9
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&,
llvm::SmallVector<clang::Parser::LateParsedAttribute*, 2u>*) + 1049
22 clang           0x000000000159a06f
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1151
23 clang           0x0000000001584f38
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 248
24 clang           0x00000000015853f9
25 clang           0x00000000015854ef
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
26 clang           0x0000000001587984
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 116
27 clang           0x0000000001587fc3
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 195
28 clang           0x00000000015833b6 clang::ParseAST(clang::Sema&, bool, bool)
+ 278
29 clang           0x00000000014d1283 clang::FrontendAction::Execute() + 131
30 clang           0x00000000014b1ad9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 329
31 clang           0x0000000001303ff5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1413
32 clang           0x000000000074226a cc1_main(char const**, char const**, char
const*, void*) + 7018
33 clang           0x000000000072ecb9 main + 7321
34 libc.so.6       0x00007f7140cc9735 __libc_start_main + 245
35 clang           0x000000000073f159
Stack dump:
0.    Program arguments: clang -cc1 -ast-dump ./test.cpp 
1.    ./test.cpp:11:16: current parser token ')'
2.    ./test.cpp:9:15: parsing function body 'test_1'
3.    ./test.cpp:9:15: in compound statement ('{}')
Aborted (core dumped)

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