From 8c2bdef36dbdb5b830757a4f74a7600b45828698 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 8 Nov 2015 19:16:56 +0100 Subject: [PATCH] Fix a segfault in dffinit when the value has too few bits The code was already trying to add the required number of bits, but fell one short of the mark. --- passes/techmap/dffinit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/techmap/dffinit.cc b/passes/techmap/dffinit.cc index 6a80f043b..e0273f439 100644 --- a/passes/techmap/dffinit.cc +++ b/passes/techmap/dffinit.cc @@ -100,7 +100,7 @@ struct DffinitPass : public Pass { for (int i = 0; i < GetSize(sig); i++) { if (init_bits.count(sig[i]) == 0) continue; - while (GetSize(value.bits) < i) + while (GetSize(value.bits) <= i) value.bits.push_back(State::S0); value.bits[i] = init_bits.at(sig[i]); cleanup_bits.insert(sig[i]);