Closed llvmbot closed 13 years ago
$ 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:
This might be related to llvm/llvm-project#8799 .
Fixed in r117853.
I'm working on this.
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. }
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:
This might be related to llvm/llvm-project#8799 .