From dc5ccd2d6941289a6a7d3c918b10b493f44a7f56 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 18 Jul 2026 18:29:04 -0700 Subject: [PATCH] ArrivalVisitor::pruneCrprArrivals() seg fault (replace pr477) Signed-off-by: James Cherry --- search/ClkInfo.cc | 9 +++++++++ search/ClkInfo.hh | 3 ++- search/Search.cc | 15 ++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/search/ClkInfo.cc b/search/ClkInfo.cc index 53526799..98aa9d4e 100644 --- a/search/ClkInfo.cc +++ b/search/ClkInfo.cc @@ -118,6 +118,15 @@ ClkInfo::crprClkVertexId(const StaState *sta) const return crpr_clk_path_.vertexId(sta); } +const MinMax * +ClkInfo::crprClkMinMax(const StaState *sta) const +{ + if (crpr_clk_path_.isNull()) + return nullptr; + else + return crpr_clk_path_.tag(sta)->minMax(); +} + Path * ClkInfo::crprClkPath(const StaState *sta) { diff --git a/search/ClkInfo.hh b/search/ClkInfo.hh index a83529d5..9ee6802d 100644 --- a/search/ClkInfo.hh +++ b/search/ClkInfo.hh @@ -78,13 +78,14 @@ public: // Null for clocks because the path cannot point to itself. Path *crprClkPath(const StaState *sta); const Path *crprClkPath(const StaState *sta) const; + const Path *crprClkPathRaw() const; VertexId crprClkVertexId(const StaState *sta) const; + const MinMax *crprClkMinMax(const StaState *sta) const; bool hasCrprClkPin() const { return !crpr_clk_path_.isNull(); } // This clk_info/tag is used for a generated clock source path. bool isGenClkSrcPath() const { return is_gen_clk_src_path_; } size_t hash() const { return hash_; } bool crprPathRefsFilter() const { return crpr_path_refs_filter_; } - const Path *crprClkPathRaw() const; static int cmp(const ClkInfo *clk_info1, const ClkInfo *clk_info2, diff --git a/search/Search.cc b/search/Search.cc index 69be1f7f..35270944 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -1396,13 +1396,15 @@ ArrivalVisitor::pruneCrprArrivals() size_t path_index = path_itr->second; const ClkInfo *clk_info = tag->clkInfo(); bool deleted_tag = false; - if (!tag->isClock() && clk_info->hasCrprClkPin()) { - const MinMax *min_max = tag->minMax(); + if (!tag->isClock() + && clk_info->hasCrprClkPin()) { Path *path_no_crpr = tag_bldr_no_crpr_->tagMatchPath(tag); - if (path_no_crpr) { + if (path_no_crpr + && path_no_crpr->tag(this) != tag) { Arrival max_arrival = path_no_crpr->arrival(); const ClkInfo *clk_info_no_crpr = path_no_crpr->clkInfo(this); Arrival max_crpr = crpr->maxCrpr(clk_info_no_crpr); + const MinMax *min_max = tag->minMax(); Arrival max_arrival_max_crpr = (min_max == MinMax::max()) ? delayDiff(max_arrival, max_crpr, this) : delaySum(max_arrival, max_crpr, this); @@ -1412,11 +1414,10 @@ ArrivalVisitor::pruneCrprArrivals() delayAsString(max_crpr, this), delayAsString(max_arrival_max_crpr, this)); Arrival arrival = tag_bldr_->arrival(path_index); - // Latch D->Q path uses enable min so crpr clk path min/max - // does not match the path min/max. if (delayGreater(max_arrival_max_crpr, arrival, min_max, this) - && clk_info_no_crpr->crprClkPath(this)->minMax(this) - == clk_info->crprClkPath(this)->minMax(this)) { + // Latch D->Q path uses enable min so crpr clk path min/max + // does not match the path min/max. + && clk_info_no_crpr->crprClkMinMax(this) == clk_info->crprClkMinMax(this)) { debugPrint(debug_, "search", 3, " pruned {}", tag->to_string(this)); path_itr = path_index_map.erase(path_itr);