[cfe-dev] assertion failed when view exploded graph

Lou Wynn via cfe-dev cfe-dev at lists.llvm.org
Sun Oct 7 19:16:53 PDT 2018


Hi,

When I ran the ViewExplodedGraph checker following the workbook here: 
https://github.com/haoNoQ/clang-analyzer-guide/releases/download/v0.1/clang-analyzer-guide-v0.1.pdf 
(BTW, this is the great workbook. I wished that I had seen it earlier 
before tracing checkers in debug mode), I got an assertion failure. The 
test code and command output are as follows.

Clang revision:

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343150 
91177308-0d34-0410-b5e6-96231b3b80d8

$ cat cltext.c
void foo(int x) {
   int y, z;
   if (x == 0)
     y = 5;
   if (!x)
     z = 6;
}

$ ~/work/git-repos/llvm/debug-git/bin/clang-8 -cc1 -analyze 
-analyzer-checker=debug.ViewExplodedGraph cltext.c
Writing '/tmp/ExprEngine-388602.dot'... clang-8: 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/AST/Stmt.cpp:307: 
int64_t clang::Stmt::getID(const clang::ASTContext &) const: Assertion 
`Out && "Wrong allocator used"' failed.
Stack dump:
0.    Program arguments: 
/home/lu/work/git-repos/llvm/debug-git/bin/clang-8 -cc1 -analyze 
-analyzer-checker=debug.ViewExplodedGraph cltext.c
1.    <eof> parser at end of file
#0 0x00007f433db989d9 llvm::sys::PrintStackTrace(llvm::raw_ostream&) 
/home/lu/work/git-repos/llvm/src-git/lib/Support/Unix/Signals.inc:490:11
#1 0x00007f433db98b89 PrintStackTraceSignalHandler(void*) 
/home/lu/work/git-repos/llvm/src-git/lib/Support/Unix/Signals.inc:554:1
#2 0x00007f433db96de6 llvm::sys::RunSignalHandlers() 
/home/lu/work/git-repos/llvm/src-git/lib/Support/Signals.cpp:66:5
#3 0x00007f433db991a7 SignalHandler(int) 
/home/lu/work/git-repos/llvm/src-git/lib/Support/Unix/Signals.inc:353:1
#4 0x00007f433cf29390 __restore_rt 
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#5 0x00007f433a955428 gsignal 
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#6 0x00007f433a95702a abort 
/build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#7 0x00007f433a94dbd7 __assert_fail_base 
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#8 0x00007f433a94dc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#9 0x00007f433939254e clang::Stmt::getID(clang::ASTContext const&) const 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/AST/Stmt.cpp:0:3
#10 0x00007f43346563c0 
llvm::DOTGraphTraits<clang::ento::ExplodedGraph*>::dumpProgramPoint(clang::ProgramPoint, 
clang::ASTContext const&, llvm::raw_string_ostream&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:3121:11
#11 0x00007f4334654d46 
llvm::DOTGraphTraits<clang::ento::ExplodedGraph*>::getNodeLabel[abi:cxx11](clang::ento::ExplodedNode 
const*, clang::ento::ExplodedGraph*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:3164:7
#12 0x00007f433465239a 
llvm::GraphWriter<clang::ento::ExplodedGraph*>::writeNode(clang::ento::ExplodedNode*) 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:173:30
#13 0x00007f4334652000 
llvm::GraphWriter<clang::ento::ExplodedGraph*>::writeNodes() 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:156:5
#14 0x00007f4334651bc8 
llvm::GraphWriter<clang::ento::ExplodedGraph*>::writeGraph(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&) 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:122:55
#15 0x00007f4334651b01 llvm::raw_ostream& 
llvm::WriteGraph<clang::ento::ExplodedGraph*>(llvm::raw_ostream&, 
clang::ento::ExplodedGraph* const&, bool, llvm::Twine const&) 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:316:5
#16 0x00007f43346519c5 std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
llvm::WriteGraph<clang::ento::ExplodedGraph*>(clang::ento::ExplodedGraph* 
const&, llvm::Twine const&, bool, llvm::Twine const&) 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:339:3
#17 0x00007f433463eed2 void 
llvm::ViewGraph<clang::ento::ExplodedGraph*>(clang::ento::ExplodedGraph* 
const&, llvm::Twine const&, bool, llvm::Twine const&, 
llvm::GraphProgram::Name) 
/home/lu/work/git-repos/llvm/src-git/include/llvm/Support/GraphWriter.h:0:26
#18 0x00007f433463a0b8 clang::ento::ExprEngine::ViewGraph(bool) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:3212:1
#19 0x00007f4334c759a5 (anonymous 
namespace)::ExplodedGraphViewer::checkEndAnalysis(clang::ento::ExplodedGraph&, 
clang::ento::BugReporter&, clang::ento::ExprEngine&) const 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp:206:3
#20 0x00007f4334c75978 void 
clang::ento::check::EndAnalysis::_checkEndAnalysis<(anonymous 
namespace)::ExplodedGraphViewer>(void*, clang::ento::ExplodedGraph&, 
clang::ento::BugReporter&, clang::ento::ExprEngine&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/include/clang/StaticAnalyzer/Core/Checker.h:231:3
#21 0x00007f43345f02da clang::ento::CheckerFn<void 
(clang::ento::ExplodedGraph&, clang::ento::BugReporter&, 
clang::ento::ExprEngine&)>::operator()(clang::ento::ExplodedGraph&, 
clang::ento::BugReporter&, clang::ento::ExprEngine&) const 
/home/lu/work/git-repos/llvm/src-git/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h:70:5
#22 0x00007f43345ec158 
clang::ento::CheckerManager::runCheckersForEndAnalysis(clang::ento::ExplodedGraph&, 
clang::ento::BugReporter&, clang::ento::ExprEngine&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:0:5
#23 0x00007f433462c9f7 clang::ento::ExprEngine::processEndWorklist(bool) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:566:1
#24 0x00007f433460ff9c 
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*, 
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:150:10
#25 0x00007f43357590c5 
clang::ento::ExprEngine::ExecuteWorkList(clang::LocationContext const*, 
unsigned int) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:165:19
#26 0x00007f43356f4a67 (anonymous 
namespace)::AnalysisConsumer::ActionExprEngine(clang::Decl*, bool, 
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl 
const*, llvm::DenseMapInfo<clang::Decl const*> >*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:749:7
#27 0x00007f43356f4881 (anonymous 
namespace)::AnalysisConsumer::RunPathSensitiveChecks(clang::Decl*, 
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl 
const*, llvm::DenseMapInfo<clang::Decl const*> >*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:763:5
#28 0x00007f43356f4535 (anonymous 
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int, 
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl 
const*, llvm::DenseMapInfo<clang::Decl const*> >*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:720:15
#29 0x00007f43356e7301 (anonymous 
namespace)::AnalysisConsumer::HandleDeclsCallGraph(unsigned int) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:510:5
#30 0x00007f43356e5ec8 (anonymous 
namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:560:3
#31 0x00007f43356e50e9 (anonymous 
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:0:5
#32 0x00007f433814054d clang::ParseAST(clang::Sema&, bool, bool) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/Parse/ParseAST.cpp:177:12
#33 0x00007f433b9c3c7c clang::ASTFrontendAction::ExecuteAction() 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/Frontend/FrontendAction.cpp:1018:1
#34 0x00007f433b9c36d0 clang::FrontendAction::Execute() 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/Frontend/FrontendAction.cpp:919:7
#35 0x00007f433b926ff0 
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/Frontend/CompilerInstance.cpp:965:7
#36 0x00007f433b5b473c 
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:259:8
#37 0x000000000023f76b cc1_main(llvm::ArrayRef<char const*>, char 
const*, void*) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/tools/driver/cc1_main.cpp:218:11
#38 0x0000000000232522 ExecuteCC1Tool(llvm::ArrayRef<char const*>, 
llvm::StringRef) 
/home/lu/work/git-repos/llvm/src-git/tools/clang/tools/driver/driver.cpp:310:5
#39 0x0000000000231158 main 
/home/lu/work/git-repos/llvm/src-git/tools/clang/tools/driver/driver.cpp:382:5
#40 0x00007f433a940830 __libc_start_main 
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#41 0x0000000000230029 _start 
(/home/lu/work/git-repos/llvm/debug-git/bin/clang-8+0x230029)


-- 
Love,
Lou

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181007/7cbef1ac/attachment.html>


More information about the cfe-dev mailing list