Commit fae99416d ("Only init modwalker once.") introduced a shared
ModWalker in OptDffWorker reused across run_constbits() and
run_eqbits(). However, when run_constbits() proves a flip-flop bit is
constant, the below sequence occurs:
OptDffPass::execute()
|
+-> worker.run_constbits()
| |-> fold_const_bits()
| | `-> add_const_target()
| | `-> worker.get_modwalker() #[caches FF Cell* info in modwalker]
| |-> ...
| `-> worker.remove_ff_bits()
| `-> new_ff.emit() #[deletes FF Cell* info in module. cell info in modwalker is stale]
|
`-> worker.run_eqbits()
|-> gather_initial_eq_classes()
`-> filter_classes_sim()
|-> BitSim::sim() #[passes modwalker which has stale cell info]
`-> sim.eval_bit()
|-> cell = modwalker...find().cell #[derives stale cell info]
`-> if (cell->is_builtin_ff()) #[*** crashed as cell pointer is already freed *** ]
So, reset modwalker_ptr in remove_ff_bits() whenever flip-flop bits
are removed so run_eqbits() rebuilds a fresh ModWalker only when the
module netlist was modified.
Reported-by: Sean Luchen <[email protected]>
Signed-off-by: Lokesh Vutla <[email protected]>
- use CIBW_CONFIG_SETTINGS to pass cmake options
- disable homebrew for wheel build - bison is set explicitly
- update cmake option parsing to use shlex so multiple arguments can be provided
- use common CIBW environment (MACOSX_DEPLOYMENT_TARGET has no effect on linux)
When `run_command` reads subprocess output via `fgets` in a multi-threaded process, incoming signals can interrupt the underlying `read` syscall with `EINTR`. Previously, `while (fgets(...) != NULL)` exited the read loop immediately on `EINTR` and called `pclose`, closing the pipe early while the child was still running (or causing the child to die with `SIGPIPE`). Additionally, `run_command` returned `WEXITSTATUS(ret)` without checking `WIFEXITED(ret)`, which evaluates to `0` when a child terminates due to an unhandled signal.
Retry `fgets` after clearing the stream error state when `ferror(f) && errno == EINTR`, and return `-1` if `!WIFEXITED(ret)`.
$shr and $shift sign-extend A to max(A_WIDTH, Y_WIDTH) before shifting.
shiftadd resliced A without that extension and left A_SIGNED set, so the
narrowed A was sign-extended a second time, from the wrong bit. Bake the
extension in before reslicing and clear A_SIGNED.
When the constant offset consumed all of A this also left an empty A on a
signed $shr, which techmap lowered to x.
Fixes#6214, fixes#6041.