3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-08-07 14:41:26 +00:00

signorm: an unconnected output port does not claim a driver

setup_driven_wires() gave a zero-width port connection -- an output left
unattached, `.q_bar()` -- a helper wire and recorded the cell as its driver.
Nothing ever retracts that: unsetPort skips zero-width connections, as does
signorm_index_add when adding them. So removing the cell left the helper wire
pointing at freed memory, and the next `check` dereferenced it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQU5XCqDYY8MbivGkNRrDo
This commit is contained in:
Emil J. Tywoniak 2026-07-21 19:20:42 +02:00
parent 7adb81e36e
commit 5d38ce7a54

View file

@ -118,6 +118,14 @@ struct RTLIL::SigNormIndex
xlog("\t%s = %s\n", module->design->twines.str(port).c_str(), log_signal(sig));
if (cell->port_dir(port) == RTLIL::PD_INPUT)
continue;
// An output left unconnected (`.q_bar()`) drives nothing, and
// `signorm_index_add` declines to record a zero-width one.
// Claiming a driver here anyway leaves a wire pointing at the
// cell that `unsetPort` will never clear, because it too skips
// zero-width connections -- so removing the cell strands the
// wire on freed memory.
if (GetSize(sig) == 0)
continue;
xlog("%s is not an input in design %p\n", module->design->twines.str(port).c_str(), module->design);
if (sig.is_wire()) {
Wire * wire = sig.as_wire();