aboutsummaryrefslogtreecommitdiffstats
path: root/libs/subcircuit
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-03-03 13:33:02 +0100
committerClifford Wolf <clifford@clifford.at>2013-03-03 13:33:02 +0100
commitafb4fa1aeaebf6736d26293709086ffd5cd1b653 (patch)
tree13833e74a8fa834fae35ff0a07da53d944732497 /libs/subcircuit
parent45bfe26f5f906c9c847ba2bd328413746a2c869c (diff)
downloadyosys-afb4fa1aeaebf6736d26293709086ffd5cd1b653.tar.gz
yosys-afb4fa1aeaebf6736d26293709086ffd5cd1b653.tar.bz2
yosys-afb4fa1aeaebf6736d26293709086ffd5cd1b653.zip
Fixed memory corruption in subcircuit miner
Diffstat (limited to 'libs/subcircuit')
-rw-r--r--libs/subcircuit/subcircuit.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/subcircuit/subcircuit.cc b/libs/subcircuit/subcircuit.cc
index 2c6f3d827..0138d5a0f 100644
--- a/libs/subcircuit/subcircuit.cc
+++ b/libs/subcircuit/subcircuit.cc
@@ -68,8 +68,10 @@ SubCircuit::Graph::Graph(const Graph &other, const std::vector<std::string> &oth
for (auto &i1 : other2this)
for (auto &i2 : other.nodes[i1.first].ports)
for (auto &i3 : i2.bits)
- if (edges2this.count(i3.edgeIdx) == 0)
- edges2this[i3.edgeIdx] = edges2this.size();
+ if (edges2this.count(i3.edgeIdx) == 0) {
+ int next_idx = edges2this.size();
+ edges2this[i3.edgeIdx] = next_idx;
+ }
edges.resize(edges2this.size());
for (auto &it : edges2this) {