Repository navigation
Reject overflowing replication widths before constant folding - #5
Closed
willpartcl wants to merge 1 commit into
Closed
willpartcl wants to merge 1 commit into
willpartcl wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Oversized nested replications such as
{16777216{{256{1'b0}}}}wrap the computed width to zero beforerequireValidBitWidthruns. Constant folding then reaches a malformed value and can SIGSEGV. A nonzero wrap, such as count 16777217, fails similarly.Perform the multiplication in a 64-bit SVInt so the existing width guard sees the complete result and emits ValueExceedsMaxBitWidth before folding. The signed 32-bit count and supported operand width fit safely in this width; valid limits and diagnostics stay unchanged.
Regression tests cover seven oversized count/width pairs with 0, 1, and x bits, plus valid small and maximum-width vectors. Before the fix the overflow regression SIGSEGVs while the maximum-width control passes. After the fix all 2,208 unit tests pass (22,128 assertions). The repository pre-commit checks pass on both changed files. Tests ran on SLURM; detailed logs are in
/media/nvme1/tmp/will-issuefix/work/replication-width/.Addresses partcleda/boson#5421; Boson will receive the fix via its yosys-slang submodule pin.
AI disclosure: implemented and tested with OpenAI Codex. Draft pending the human review required by CONTRIBUTING.md; no reviewer requested.
Need help on this PR? Tag
@codesmith-botwith what you need.