mirror of https://github.com/YosysHQ/yosys.git
Fixed use-after-free dict<> usage pattern in hierarchy.cc
This commit is contained in:
parent
b4d544f0d9
commit
00f29d5e5c
|
@ -322,10 +322,12 @@ bool set_keep_assert(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
|
||||||
int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
|
int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
|
||||||
{
|
{
|
||||||
if (db.count(module) == 0) {
|
if (db.count(module) == 0) {
|
||||||
|
int score = 0;
|
||||||
db[module] = 0;
|
db[module] = 0;
|
||||||
for (auto cell : module->cells())
|
for (auto cell : module->cells())
|
||||||
if (design->module(cell->type))
|
if (design->module(cell->type))
|
||||||
db[module] = max(db[module], find_top_mod_score(design, design->module(cell->type), db) + 1);
|
score = max(score, find_top_mod_score(design, design->module(cell->type), db) + 1);
|
||||||
|
db[module] = score;
|
||||||
}
|
}
|
||||||
return db.at(module);
|
return db.at(module);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue