LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 26074 - Assertion in ~CallGraphNode "Node deleted while references remain"
Summary: Assertion in ~CallGraphNode "Node deleted while references remain"
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Global Analyses (show other bugs)
Version: trunk
Hardware: PC FreeBSD
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 26059
  Show dependency tree
 
Reported: 2016-01-08 04:22 PST by andrew
Modified: 2016-02-17 08:59 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
.cpp, .sh, and .ll showing the assertion (11.50 KB, application/octet-stream)
2016-01-08 04:22 PST, andrew
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andrew 2016-01-08 04:22:38 PST
Created attachment 15589 [details]
.cpp, .sh, and .ll showing the assertion

I can hit the following assertion while building Firefox on FreeBSD on AArch64:

Assertion failed: (NumReferences == 0 && "Node deleted while references remain"), function ~CallGraphNode, file /usr/src/lib/clang/libllvmipa/../../../contrib/llvm/include/llvm/Analysis/CallGraph.h, line 179.

The attached tar file contains the .sh clang output, a minimized .cpp file, and the lr from this file with no optimization.
Comment 1 Dimitry Andric 2016-01-08 05:24:51 PST
Minimal command line to reproduce the assertion:

clang -cc1 -triple aarch64-unknown-freebsd -emit-obj Unified_cpp_js_src6-540de0.cpp

Using -triple aarch64-unknown-linux also asserts.
Comment 2 Dimitry Andric 2016-01-08 05:27:20 PST
Backtrace (don't have any symbols right now):

#0  0x2b4c47f3 in thr_kill () from /lib/libc.so.7
#1  0x2b4c47d8 in __raise (s=0) at /usr/src/lib/libc/gen/raise.c:52
#2  0x2b4c4713 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
#3  0x2b542a78 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>) at /usr/src/lib/libc/gen/assert.c:51
#4  0x08ba52b8 in std::__1::__tree<std::__1::__value_type<llvm::Function const*, std::__1::unique_ptr<llvm::CallGraphNode, std::__1::default_delete<llvm::CallGraphNode> > >, std::__1::__map_value_compare<llvm::Function const*, std::__1::__value_type<llvm::Function const*, std::__1::unique_ptr<llvm::CallGraphNode, std::__1::default_delete<llvm::CallGraphNode> > >, std::__1::less<llvm::Function const*>, true>, std::__1::allocator<std::__1::__value_type<llvm::Function const*, std::__1::unique_ptr<llvm::CallGraphNode, std::__1::default_delete<llvm::CallGraphNode> > > > >::erase(std::__1::__tree_const_iterator<std::__1::__value_type<llvm::Function const*, std::__1::unique_ptr<llvm::CallGraphNode, std::__1::default_delete<llvm::CallGraphNode> > >, std::__1::__tree_node<std::__1::__value_type<llvm::Function const*, std::__1::unique_ptr<llvm::CallGraphNode, std::__1::default_delete<llvm::CallGraphNode> > >, void*>*, int>) ()
#5  0x08ba2d12 in llvm::CallGraph::removeFunctionFromModule(llvm::CallGraphNode*) ()
#6  0x08fe6691 in llvm::Inliner::removeDeadFunctions(llvm::CallGraph&, bool) ()
#7  0x08fe5d97 in llvm::Inliner::doFinalization(llvm::CallGraph&) ()
#8  0x09c67d77 in (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) ()
#9  0x08f4f067 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#10 0x08f4f6f8 in llvm::legacy::PassManager::run(llvm::Module&) ()
#11 0x09431a9c in clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*, std::__1::unique_ptr<llvm::FunctionInfoIndex, std::__1::default_delete<llvm::FunctionInfoIndex> >) ()
#12 0x09b2dcd8 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#13 0x09edd175 in clang::ParseAST(clang::Sema&, bool, bool) ()
#14 0x097c8526 in clang::ASTFrontendAction::ExecuteAction() ()
#15 0x09b2c37e in clang::CodeGenAction::ExecuteAction() ()
#16 0x097c7dc3 in clang::FrontendAction::Execute() ()
#17 0x09790b3a in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#18 0x0984a51a in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#19 0x082f75d0 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ()
#20 0x082f6024 in main ()
Comment 3 Hans Wennborg 2016-02-16 15:38:34 PST
(In reply to comment #1)
> Minimal command line to reproduce the assertion:
> 
> clang -cc1 -triple aarch64-unknown-freebsd -emit-obj
> Unified_cpp_js_src6-540de0.cpp
> 
> Using -triple aarch64-unknown-linux also asserts.

This doesn't reproduce for me with trunk or 3.8 Clang. Did it get fixed somehow?
Comment 4 andrew 2016-02-17 08:59:59 PST
Fixed in r257279.