aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt
diff options
context:
space:
mode:
authorMarcelina Koƛcielnicka <mwk@0x04.net>2022-06-13 12:22:59 +0200
committerMarcelina Koƛcielnicka <mwk@0x04.net>2022-06-13 14:04:04 +0200
commit1ff0e1a58a350c03f59053a584d2e4b76a5a1b80 (patch)
treed23fa8084d31904f19f12cb8a98b15a1696e1e22 /passes/opt
parentddc8044655cf19878f02db13bd48fc5731989544 (diff)
downloadyosys-1ff0e1a58a350c03f59053a584d2e4b76a5a1b80.tar.gz
yosys-1ff0e1a58a350c03f59053a584d2e4b76a5a1b80.tar.bz2
yosys-1ff0e1a58a350c03f59053a584d2e4b76a5a1b80.zip
opt_ffinv: Fix use after free.
Diffstat (limited to 'passes/opt')
-rw-r--r--passes/opt/opt_ffinv.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/passes/opt/opt_ffinv.cc b/passes/opt/opt_ffinv.cc
index fe5b59fa5..5d989dafd 100644
--- a/passes/opt/opt_ffinv.cc
+++ b/passes/opt/opt_ffinv.cc
@@ -201,10 +201,13 @@ struct OptFfInvWorker
{
log("Discovering LUTs.\n");
- for (Cell *cell : module->selected_cells()) {
- if (!RTLIL::builtin_ff_cell_types().count(cell->type))
- continue;
+ std::vector<Cell *> ffs;
+
+ for (Cell *cell : module->selected_cells())
+ if (RTLIL::builtin_ff_cell_types().count(cell->type))
+ ffs.push_back(cell);
+ for (Cell *cell : ffs) {
FfData ff(&initvals, cell);
if (ff.has_sr)
continue;