[llvm] Reland "[Support] Assert that DomTree nodes share parent"" (PR #102782)

Mikael Holmén via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 03:44:14 PDT 2024


mikaelholmen wrote:

Hi,

I hit the new assertion with
```
clang -cc1 -analyze -analyzer-checker=core bbi-98084.c
```
Result:
```
clang: ../include/llvm/Support/GenericDomTree.h:401: DomTreeNodeBase<NodeT> *llvm::DominatorTreeBase<clang::CFGBlock, true>::getNode(const NodeT *) const [NodeT = clang::CFGBlock, IsPostDom = true]: Assertion `(!BB || Parent == NodeTrait::getParent(const_cast<NodeT *>(BB))) && "cannot get DomTreeNode of block with different parent"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: build-all/bin/clang -cc1 -analyze -analyzer-checker=core bbi-98084.c
1.	<eof> parser at end of file
 #0 0x000055c5fc23be87 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/clang+0x7ed5e87)
 #1 0x000055c5fc2399ee llvm::sys::RunSignalHandlers() (build-all/bin/clang+0x7ed39ee)
 #2 0x000055c5fc23c54f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f50ecd71cf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
 #4 0x00007f50ea92aacf raise (/lib64/libc.so.6+0x4eacf)
 #5 0x00007f50ea8fdea5 abort (/lib64/libc.so.6+0x21ea5)
 #6 0x00007f50ea8fdd79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
 #7 0x00007f50ea923426 (/lib64/libc.so.6+0x47426)
 #8 0x000055c5fded94df (build-all/bin/clang+0x9b734df)
 #9 0x000055c5fded8906 llvm::IDFCalculatorBase<clang::CFGBlock, true>::calculate(llvm::SmallVectorImpl<clang::CFGBlock*>&) (build-all/bin/clang+0x9b72906)
#10 0x000055c5fded6ff6 clang::ControlDependencyCalculator::getControlDependencies(clang::CFGBlock*) DebugCheckers.cpp:0:0
#11 0x000055c5fe247da1 (anonymous namespace)::TrackControlDependencyCondBRVisitor::VisitNode(clang::ento::ExplodedNode const*, clang::ento::BugReporterContext&, clang::ento::PathSensitiveBugReport&) BugReporterVisitors.cpp:0:0
#12 0x000055c5fe232c85 generateVisitorsDiagnostics(clang::ento::PathSensitiveBugReport*, clang::ento::ExplodedNode const*, clang::ento::BugReporterContext&) BugReporter.cpp:0:0
#13 0x000055c5fe22e574 clang::ento::PathSensitiveBugReporter::generatePathDiagnostics(llvm::ArrayRef<clang::ento::PathDiagnosticConsumer*>, llvm::ArrayRef<clang::ento::PathSensitiveBugReport*>&) (build-all/bin/clang+0x9ec8574)
#14 0x000055c5fe231b9b clang::ento::PathSensitiveBugReporter::generateDiagnosticForConsumerMap(clang::ento::BugReport*, llvm::ArrayRef<clang::ento::PathDiagnosticConsumer*>, llvm::ArrayRef<clang::ento::BugReport*>) (build-all/bin/clang+0x9ecbb9b)
#15 0x000055c5fe22bee6 clang::ento::BugReporter::FlushReport(clang::ento::BugReportEquivClass&) (build-all/bin/clang+0x9ec5ee6)
#16 0x000055c5fe22bcbb clang::ento::BugReporter::FlushReports() (build-all/bin/clang+0x9ec5cbb)
#17 0x000055c5fde0e3dd (anonymous namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int, clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*, llvm::DenseMapInfo<clang::Decl const*, void>>*) AnalysisConsumer.cpp:0:0
#18 0x000055c5fdde70ab (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) AnalysisConsumer.cpp:0:0
#19 0x000055c5fe391847 clang::ParseAST(clang::Sema&, bool, bool) (build-all/bin/clang+0xa02b847)
#20 0x000055c5fceea190 clang::FrontendAction::Execute() (build-all/bin/clang+0x8b84190)
#21 0x000055c5fce55c7f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (build-all/bin/clang+0x8aefc7f)
#22 0x000055c5fcfd7d3e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (build-all/bin/clang+0x8c71d3e)
#23 0x000055c5f9abe8f6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (build-all/bin/clang+0x57588f6)
#24 0x000055c5f9abb09d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#25 0x000055c5f9ab9de4 clang_main(int, char**, llvm::ToolContext const&) (build-all/bin/clang+0x5753de4)
#26 0x000055c5f9acb5b7 main (build-all/bin/clang+0x57655b7)
#27 0x00007f50ea916d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#28 0x000055c5f9ab89ae _start (build-all/bin/clang+0x57529ae)
Abort (core dumped)
```
[bbi-98084.c.gz](https://github.com/user-attachments/files/16624373/bbi-98084.c.gz)


https://github.com/llvm/llvm-project/pull/102782


More information about the llvm-commits mailing list