diff options
author | gatecat <gatecat@ds0.me> | 2021-06-17 18:32:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-17 18:32:43 +0100 |
commit | 0f9a88b2cd84c561df11690c07af12373bf0941f (patch) | |
tree | fd1aa50ac6f231b23322e29a9a27faed615dfa02 | |
parent | 167867ff7ce41a05f55ea4aae4370ef760b9ae0a (diff) | |
parent | 889c295baf8b44160305fe3474b16afbb8634151 (diff) | |
download | nextpnr-0f9a88b2cd84c561df11690c07af12373bf0941f.tar.gz nextpnr-0f9a88b2cd84c561df11690c07af12373bf0941f.tar.bz2 nextpnr-0f9a88b2cd84c561df11690c07af12373bf0941f.zip |
Merge pull request #731 from YosysHQ/gatecat/timing-mem-error
sta: Fix a memory error introduced by using dict instead of unordered_map
-rw-r--r-- | common/timing.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/common/timing.cc b/common/timing.cc index d0a3b29a..30054e83 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -807,13 +807,20 @@ struct Timing } // Go forwards topologically to find the maximum arrival time and max path length for each net + std::vector<ClockEvent> startdomains; for (auto net : topological_order) { if (!net_data.count(net)) continue; - auto &nd_map = net_data.at(net); - for (auto &startdomain : nd_map) { - ClockEvent start_clk = startdomain.first; - auto &nd = startdomain.second; + // Updates later on might invalidate a reference taken here to net_data, so iterate over a list of domains + // instead + startdomains.clear(); + { + auto &nd_map = net_data.at(net); + for (auto &startdomain : nd_map) + startdomains.push_back(startdomain.first); + } + for (auto &start_clk : startdomains) { + auto &nd = net_data.at(net).at(start_clk); if (nd.false_startpoint) continue; const auto net_arrival = nd.max_arrival; |