[LLVMbugs] [Bug 8427] New: 'clang --analyze' crashes in template code after an operator declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 20 22:54:45 PDT 2010


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

           Summary: 'clang --analyze' crashes in template code after an
                    operator declaration
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: zhanyong.wan at gmail.com
                CC: llvmbugs at cs.uiuc.edu


$ cat test.cc
class Dummy {};

bool operator!=(Dummy, int);

template <typename T>
class Foo {
  bool Bar();
};

template <typename T>
bool Foo<T>::Bar() {
  return 0 == T();
}

$ clang --analyze test.cc
0  clang       0x0000000001f49aec
1  clang       0x0000000001f498e8
2  libpthread.so.0 0x00007f68707cc9f0
3  clang       0x0000000000e43014 clang::BlockPointerType::getPointeeType()
const + 16
4  clang       0x000000000108a3c8
5  clang       0x000000000108a40a
6  clang       0x0000000001093299
clang::GRExprEngine::VisitCall(clang::CallExpr const*, clang::ExplodedNode*,
clang::ConstExprIterator, clang::ConstExprIterator, clang::ExplodedNodeSet&,
bool) + 1539
7  clang       0x000000000108dbe9 clang::GRExprEngine::Visit(clang::Stmt
const*, clang::ExplodedNode*, clang::ExplodedNodeSet&) + 1597
8  clang       0x000000000108d421
clang::GRExprEngine::ProcessStmt(clang::CFGElement, clang::GRStmtNodeBuilder&)
+ 2091
9  clang       0x0000000001071871
clang::GRCoreEngine::ProcessStmt(clang::CFGElement, clang::GRStmtNodeBuilder&)
+ 69
10 clang       0x000000000106eae4
clang::GRCoreEngine::HandleBlockEntrance(clang::BlockEntrance const&,
clang::ExplodedNode*) + 368
11 clang       0x000000000106e407
clang::GRCoreEngine::ExecuteWorkList(clang::LocationContext const*, unsigned
int, clang::GRState const*) + 779
12 clang       0x0000000000fc317b
clang::GRExprEngine::ExecuteWorkList(clang::LocationContext const*, unsigned
int) + 47
13 clang       0x0000000000fbff87
14 clang       0x0000000000fc0086
15 clang       0x0000000000fc00fd
16 clang       0x0000000000fbfc16
17 clang       0x0000000000fbf59e
18 clang       0x000000000127c5ff clang::ParseAST(clang::Sema&, bool) + 639
19 clang       0x00000000011ccb4f clang::ASTFrontendAction::ExecuteAction() +
263
20 clang       0x00000000011cc7a3 clang::FrontendAction::Execute() + 319
21 clang       0x0000000001156761
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 747
22 clang       0x0000000000e129f1
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 877
23 clang       0x0000000000e05d59 cc1_main(char const**, char const**, char
const*, void*) + 913
24 clang       0x0000000000e0eb45 main + 481
25 libc.so.6       0x00007f686ff32d5d __libc_start_main + 253
26 clang       0x0000000000e053fe
Stack dump:
0.    Program arguments: clang -cc1 -triple x86_64-unknown-linux-gnu -analyze
-disable-free -main-file-name test.cc -analyzer-store=region
-analyzer-opt-analyze-nested-blocks -analyzer-check-dead-stores
-analyzer-check-objc-mem -analyzer-eagerly-assume
-analyzer-check-objc-methodsigs -analyzer-check-objc-unused-ivars
-analyzer-check-idempotent-operations -analyzer-output plist -w
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -resource-dir ../lib/clang/2.0 -ferror-limit
19 -fmessage-length 199 -fexceptions -fgnu-runtime -fdiagnostics-show-option -o
test.plist -x c++ test.cc 
1.    <eof> parser at end of file
2.    test.cc:12:10: Error evaluating statement
3.    test.cc:12:10: Error evaluating statement
clang: error: clang frontend command failed due to signal 11 (use -v to see
invocation)

Note that the declaration of operator!= is necessary for triggering the crash
on line 12, even though it's never used.

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