llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.66k stars 11.85k forks source link

'clang --analyze' crashes when invoking a member functor of dependent type #8805

Closed llvmbot closed 13 years ago

llvmbot commented 14 years ago
Bugzilla Link 8433
Resolution FIXED
Resolved on Oct 30, 2010 23:25
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

$ cat test.cc template class Foo { public: void Bar(); T value_; };

template void Foo::Bar() { value_(); // Crash! Note the () here. }

$ clang --analyze test.cc 0 clang 0x0000000001f49aec 1 clang 0x0000000001f498e8 2 libpthread.so.0 0x00007f99557e59f0 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 0x00007f9954f4bd5d __libc_start_main + 253 26 clang 0x0000000000e053fe Stack dump:

  1. 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 138 -fexceptions -fgnu-runtime -fdiagnostics-show-option -o test.plist -x c++ test.cc
  2. parser at end of file
  3. test.cc:10:3: Error evaluating statement
  4. test.cc:10:3: Error evaluating statement clang: error: clang frontend command failed due to signal 11 (use -v to see invocation)

This might be related to llvm/llvm-project#8799 .

llvmbot commented 13 years ago

Fixed in r117853.

llvmbot commented 14 years ago

I'm working on this.

llvmbot commented 14 years ago

More test case (invoking a member function triggers the crash too):

template class Foo { public: void Bar(); void Baz(); T value_; };

template void Foo::Bar() { Baz(); // Crash! value_(); // Crash! Note the () here. }