Get rvalue bounds for the value of lvalue expressions from the CheckingState#1183
Merged
Conversation
added 10 commits
September 8, 2021 14:05
…ue and ArrayToPointerDecay casts
… or decrement operator
… compound assignment
… observed bounds of s->a
…ds of q before the decrement q-- in the "false" conditional arm
… compound assignment p += 2 are bounds(p, p + (i - 1))
… expression for certain AbstractSets changed Since getting the observed bounds for expressions that appear on the RHS of assignments happens before updating the observed bounds of expressions that appear on the LHS, an AbstractSet is created for an expression on the RHS of an assignment before the expression on the LHS.
…->a after updating its observed bounds
This was referenced Sep 9, 2021
This was referenced Jan 15, 2022
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.
This PR modifies the way that rvalue bounds are determined for the value of a member expression, pointer deference, or array subscript to be consistent with the way that rvalue bounds are determined for the value of a variable. The rvalue bounds for the value of a variable, member expression, pointer dereference, or array subscript expression
eare determined by looking at theObservedBoundsmap in the checking state. If theAbstractSetcontainingeis present inObservedBounds, then those are the bounds for the value ofe. Otherwise, the bounds for the value ofedefault to the lvalue target bounds ofe(or the lvalue bounds ofeifeis the subexpression of anArrayToPointerDecaycast.One consequence of this change is that the order of expressions used to get or create an
AbstractSetmay differ, which may affect the representative expression for theAbstractSet. For example, consider the assignment*p = p[0] + 1. The rvalue bounds ofp[0]are determined before modifying the observed bounds of*p. This means thatp[0]is the first expression that is used to create theAbstractSetthat contains*pandp[0], sop[0]is the representative expression for thisAbstractSet.This PR also includes a minor fix in CanonBounds where
ExtVectorElementExprsare compared by address. This prevents anllvm_unreachablethat would otherwise occur when creating anAbstractSetfor a member expression that contains anExtVectorElementExpr.