-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvm_conditional_points_to
in postcondition does not respect condition
#1945
Comments
I took a closer look at the code in question. For the most part, I think it would be straightforward to refactor There is one complication: one of the leaves of |
This patch adds a `ReaderT` component to the `OverrideMatcher'` monad transformer, where the reader portions are represented with the new `OverrideEnv'` data type. Currently, the only field of `OverrideEnv'` is `_oeConditionalPred`, which is used to represent a path condition for any assumptions or assertions created in a specification. See `Note [oeConditionalPred]` for a lengthier explanation. While introducing this does require a fair bit of refactoring, this patch in isolation does not change any user-visible behavior. In a subsequent commit, we will leverage `oeConditionalPred` to introduce a fix for #1945.
This leverages the newly introduced `withConditionalPred` function (see the parent commit) to make `llvm_conditional_points_to cond ptr val` properly extend the path condition with `cond` before matching `val` against the value that `ptr` points to. Fixes #1945.
This patch adds a `ReaderT` component to the `OverrideMatcher'` monad transformer, where the reader portions are represented with the new `OverrideEnv'` data type. Currently, the only field of `OverrideEnv'` is `_oeConditionalPred`, which is used to represent a path condition for any assumptions or assertions created in a specification. See `Note [oeConditionalPred]` for a lengthier explanation. While introducing this does require a fair bit of refactoring, this patch in isolation does not change any user-visible behavior. In a subsequent commit, we will leverage `oeConditionalPred` to introduce a fix for #1945.
This leverages the newly introduced `withConditionalPred` function (see the parent commit) to make `llvm_conditional_points_to cond ptr val` properly extend the path condition with `cond` before matching `val` against the value that `ptr` points to. Fixes #1945.
This patch adds a `ReaderT` component to the `OverrideMatcher'` monad transformer, where the reader portions are represented with the new `OverrideEnv'` data type. Currently, the only field of `OverrideEnv'` is `_oeConditionalPred`, which is used to represent a path condition for any assumptions or assertions created in a specification. See `Note [oeConditionalPred]` for a lengthier explanation. While introducing this does require a fair bit of refactoring, this patch in isolation does not change any user-visible behavior. In a subsequent commit, we will leverage `oeConditionalPred` to introduce a fix for #1945.
This leverages the newly introduced `withConditionalPred` function (see the parent commit) to make `llvm_conditional_points_to cond ptr val` properly extend the path condition with `cond` before matching `val` against the value that `ptr` points to. Fixes #1945.
This patch adds a `ReaderT` component to the `OverrideMatcher'` monad transformer, where the reader portions are represented with the new `OverrideEnv'` data type. Currently, the only field of `OverrideEnv'` is `_oeConditionalPred`, which is used to represent a path condition for any assumptions or assertions created in a specification. See `Note [oeConditionalPred]` for a lengthier explanation. While introducing this does require a fair bit of refactoring, this patch in isolation does not change any user-visible behavior. In a subsequent commit, we will leverage `oeConditionalPred` to introduce a fix for #1945.
This patch adds a `ReaderT` component to the `OverrideMatcher'` monad transformer, where the reader portions are represented with the new `OverrideEnv'` data type. Currently, the only field of `OverrideEnv'` is `_oeConditionalPred`, which is used to represent a path condition for any assumptions or assertions created in a specification. See `Note [oeConditionalPred]` for a lengthier explanation. While introducing this does require a fair bit of refactoring, this patch in isolation does not change any user-visible behavior. In a subsequent commit, we will leverage `oeConditionalPred` to introduce a fix for #1945.
This leverages the newly introduced `withConditionalPred` function (see the parent commit) to make `llvm_conditional_points_to cond ptr val` properly extend the path condition with `cond` before matching `val` against the value that `ptr` points to. Fixes #1945.
Given this C code:
I would expect this SAW spec to succeed:
Surprisingly, this isn't the case:
The counterexample given (
x: 254
) doesn't make much sense, since that should fail the conditionx == 1
and therefore cause the point-to check against1 : [8]
to never occur. What is going on?My hunch is that the code here is responsible:
saw-script/src/SAWScript/Crucible/LLVM/Override.hs
Lines 1612 to 1619 in 9a390f3
This asserts a condition involving the validity of reading from the pointer's memory in a conditional points-to statement, and this does indeed take the condition into account. After this, however, it unconditionally calls
matchArg
on the right-hand side value. This is almost certainly wrong, as we should only be doing this matching step if the condition holds.Fixing this will likely require some refactoring of how
matchArg
works such that it returns a symbolic predicate representing whether the match succeeds or not. That we, we can properly construct an implication involving the condition term.The text was updated successfully, but these errors were encountered: