From 9cb838febe4dd1c217cc826826c1676e11c73c9d Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 15 Jun 2026 18:55:21 +0200 Subject: [PATCH] twine: fix another off-by-one --- kernel/rtlil.cc | 2 +- kernel/twine.cc | 1 - kernel/twine.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 2ec4abe92..47a1a2607 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1983,7 +1983,7 @@ namespace { void error(int linenr) { std::stringstream buf; - RTLIL_BACKEND::dump_cell(buf, " ", cell); + RTLIL_BACKEND::dump_cell(buf, " ", cell, cell->module->design); std::string mod_name = module ? module->design->twines.str(module->meta_->name) : std::string(); std::string cell_name = cell->module->design->twines.str(cell->meta_->name); diff --git a/kernel/twine.cc b/kernel/twine.cc index 8b5fcc91e..28ccb3a38 100644 --- a/kernel/twine.cc +++ b/kernel/twine.cc @@ -15,7 +15,6 @@ TwineRef twine_populate(std::string name) { } void twine_prepopulate() { TwinePool::globals_.reserve(STATIC_TWINE_END); - TwinePool::globals_.push_back(Twine{std::string()}); #define X(_id) twine_populate("\\" #_id); #include "kernel/constids.inc" #undef X diff --git a/kernel/twine.h b/kernel/twine.h index d602afdfa..39c15b513 100644 --- a/kernel/twine.h +++ b/kernel/twine.h @@ -265,7 +265,7 @@ struct TwinePool { } void rebuild_index() { - for (TwineRef ref = 0; ref < globals_.size(); ref++) + for (TwineRef ref = 0; ref < STATIC_TWINE_END; ref++) index.insert(ref); for (auto it = backing.begin(); it != backing.end(); ++it) index.insert(STATIC_TWINE_END + backing.get_index(it));