3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-02-22 00:07:38 +00:00

Merge pull request #5685 from chathhorn-galois/chathhorn/issue5684

Fix segfault from shift with 0-width signed arg.
This commit is contained in:
Emil J 2026-02-20 11:53:05 +01:00 committed by GitHub
commit 74f7b0cf92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 1 deletions

View file

@ -291,7 +291,7 @@ static RTLIL::Const const_shift_worker(const RTLIL::Const &arg1, const RTLIL::Co
if (pos < 0)
result.set(i, vacant_bits);
else if (pos >= BigInteger(GetSize(arg1)))
result.set(i, sign_ext ? arg1.back() : vacant_bits);
result.set(i, sign_ext && !arg1.empty() ? arg1.back() : vacant_bits);
else
result.set(i, arg1[pos.toInt()]);
}