-
Notifications
You must be signed in to change notification settings - Fork 273
Move CPROVER_{r,w,rw}_ok processing to back-end #7395
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
Move CPROVER_{r,w,rw}_ok processing to back-end #7395
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #7395 +/- ##
===========================================
+ Coverage 78.27% 78.92% +0.65%
===========================================
Files 1699 1700 +1
Lines 195410 195594 +184
===========================================
+ Hits 152953 154370 +1417
+ Misses 42457 41224 -1233
☔ View full report in Codecov by Sentry. |
Looks like we need to add __CPROVER_is_in_range to the mix |
fabc2a1
to
6e1c30e
Compare
This is done (including a few fixes specific to just that). |
6e1c30e
to
e34dbee
Compare
src/ansi-c/c_typecheck_expr.cpp
Outdated
@@ -2684,8 +2683,15 @@ exprt c_typecheck_baset::do_special_functions( | |||
|
|||
typecheck_function_call_arguments(expr); | |||
|
|||
symbol_exprt deallocated = | |||
lookup(CPROVER_PREFIX "deallocated").symbol_expr(); | |||
symbol_exprt dead = lookup(CPROVER_PREFIX "dead_object").symbol_expr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's something wrong here. The connection to deallocated
is very much a mechanism for implementing the predicate, and that shouldn't happen in the front-end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I really just moved (while also making it more obvious) something from goto_check_ct
to type checking. Both of which are in the front-end...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it help if we lowered the side-effecty function to a predicate in the built-in library?
The C implementation of the function can refer to the global state to call the built-in predicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a fundamental architectural problem with this PR.
Just imagine you had to write an SMT-LIB standard proposal for a theory like this.
bfa3212
to
d015c9d
Compare
@NlightNFotis could you give a final look? |
If you specifically want Fotis it will take a couple of weeks, but others here can take a look much sooner than that. |
I believe I have addressed all of Fotis's comments, so it should likely be just any code owner for the incremental SMT2 back-end. Will update assignments accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for the incremental SMT2 changes.
d015c9d
to
6248e6e
Compare
The evaluation of these expressions depends on the specific values of __CPROVER_deallocated and __CPROVER_dead_object at the time the expression is used. Therefore, create new prophecy_* variants of these expressions to retain the properties expected of an expression (as opposed to a statement/function call). These prophecy_* expressions can safely be passed on to back-ends, be simplified, and do not need to be rewritten during instrumentation. For now, they are just handled by lowering the expressions (in the SAT and SMT back-ends). We may, in future, decide to have back-end specific (and possibly more efficient) handling of these.
These expressions are now rewritten to their prophecy_* counterparts by goto-program conversion, and back-ends directly handle these prophecy_* expressions. Unconditional rewrites by goto_check_ct (even when no checks are enabled) are no longer necessary. Fixes: diffblue#7377
This reverts selected changes from "r/w/rw_ok and pointer_in_range depend on deallocated and dead_object" for transformations of goto programs can now safely introduce rw_ok expressions into the goto program. Not all analyses, however, are able to cope with these expressions. Dependence graphs (and any analyses building upon these), for example, also require this rewriting. goto-instrument is adjusted accordingly.
6248e6e
to
e261217
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the changes have been implemented correctly and do not raise any issues in the parts of the code that I am "owner" for.
I am as yet unsure why this is needed or why this is a good design to meet that need. However, judging by the comment history, this has been considered and it is something that I should resolve with a chat with @tautschnig rather than via github.
Let me try to clarify publicly nonetheless (the why-is-this-needed part):
|
Please review commit-by-commit.
Fixes #7377.