From 3681b0199e5ce4d3be07c01c05b55901b9aa12c6 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Thu, 19 Oct 2023 16:56:20 -0700 Subject: [PATCH] SymbolTable: Gracefully handle current CHECK-fail This situation seems to arise if we have possibly multiple parent references when fed a bunch of possibly unrelated files with naming overlap. Don't crash in this case. --- verilog/analysis/symbol_table.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/verilog/analysis/symbol_table.cc b/verilog/analysis/symbol_table.cc index 43228488d..5e547c83c 100644 --- a/verilog/analysis/symbol_table.cc +++ b/verilog/analysis/symbol_table.cc @@ -2017,7 +2017,12 @@ static void ResolveReferenceComponentNode( switch (component.ref_type) { case ReferenceType::kUnqualified: { // root node: lookup this symbol from its context upward - CHECK(node->Parent() == nullptr); + if (node->Parent() != nullptr) { + // TODO(hzeller): Is this a situation that should never happen thus + // be dealt with further up-stream ? (changed from a CHECK()). + LOG(WARNING) << *node << ": Parent exists " << *node->Parent() << "\n"; + return; + } ResolveUnqualifiedName(&component, context, diagnostics); break; }