Support extractbits_exprt with non-constant index in SMT2 backend#8897
Draft
tautschnig wants to merge 1 commit intodiffblue:developfrom
Draft
Support extractbits_exprt with non-constant index in SMT2 backend#8897tautschnig wants to merge 1 commit intodiffblue:developfrom
tautschnig wants to merge 1 commit intodiffblue:developfrom
Conversation
When the index of extractbits_exprt is not a compile-time constant, the SMT extract operator (which requires constant indices) cannot be used directly. Instead, shift the source bitvector right by the non-constant index using logical_shift_right (bvlshr), then apply a constant extract from bit 0 to (result_width - 1). If the index and source have different bit widths, the index is zero-extended or truncated to match the source width, as required by the SMT logical_shift_right operator. Unit tests updated to verify both same-width and different-width non-constant index cases. Remove the no-new-smt exclusion tag from six regression test descriptors that were blocked on non-constant extractbits support in the incremental SMT2 backend. Also promote Pointer28/test.desc from KNOWNBUG to CORE since the underlying issue is now fixed. Fixes: diffblue#8065 Co-authored-by: Michael Tautschnig <mt@debian.org>
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.
When the index of extractbits_exprt is not a compile-time constant, the SMT extract operator (which requires constant indices) cannot be used directly. Instead, shift the source bitvector right by the non-constant index using logical_shift_right (bvlshr), then apply a constant extract from bit 0 to (result_width - 1).
If the index and source have different bit widths, the index is zero-extended or truncated to match the source width, as required by the SMT logical_shift_right operator.
Unit tests updated to verify both same-width and different-width non-constant index cases.
Remove the no-new-smt exclusion tag from six regression test descriptors that were blocked on non-constant extractbits support in the incremental SMT2 backend. Also promote Pointer28/test.desc from KNOWNBUG to CORE since the underlying issue is now fixed.
Fixes: #8065