-
Notifications
You must be signed in to change notification settings - Fork 277
disambiguate two exprts with same ID #4479
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
disambiguate two exprts with same ID #4479
Conversation
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.
Looks good except one minor correction
src/util/irep_ids.def
Outdated
@@ -217,7 +217,7 @@ IREP_ID_ONE(invalid) | |||
IREP_ID_TWO(C_invalid_object, #invalid_object) | |||
IREP_ID_ONE(pointer_offset) | |||
IREP_ID_ONE(pointer_object) | |||
IREP_ID_TWO(is_invalid_pointer, is-invalid-pointer) | |||
IREP_ID_TWO(is_invalid_pointer, is_invalid_pointer) |
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.
IREP_ID_ONE
092802b
to
a6b6ddb
Compare
This commit resolves an issue where ID_dynamic_object was used to label two semantically distinct exprts. One, with a single operand, was a boolean expression meaning that the operand is a pointer to a dynamic object. This has been renamed to ID_is_dynamic_object. The second, with two operands, is an exprt representing a dynamic object itself. This has stayed ID_dynamic_object. Disambiguating which meaning was intended in each case was relatively easy, as uses of these exprts frequently come with assertions about the number of operands, and so this was used to inform which instances of ID_dynamic_object should be changed and which should be left the same.
This is a more accurate name
a6b6ddb
to
e4d3ac6
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: e4d3ac6).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106816492
src/util/pointer_predicates.h
Outdated
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected] | |||
#ifndef CPROVER_UTIL_POINTER_PREDICATES_H | |||
#define CPROVER_UTIL_POINTER_PREDICATES_H | |||
|
|||
#include "std_expr.h" | |||
#define SYMEX_DYNAMIC_PREFIX "symex_dynamic::" | |||
|
|||
class exprt; |
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.
Some of those forward declarations will now be unnecessary given the added include.
src/util/pointer_predicates.h
Outdated
@@ -33,7 +33,6 @@ exprt good_pointer_def(const exprt &pointer, const namespacet &); | |||
exprt null_object(const exprt &pointer); | |||
exprt null_pointer(const exprt &pointer); | |||
exprt integer_address(const exprt &pointer); | |||
exprt is_invalid_pointer(const exprt &pointer); |
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 guess that's ok, though generally we should first mark such functions as deprecated.
This matches the things around it better.
e4d3ac6
to
a9774ca
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: a9774ca).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106877160
The first commit is cherry-picked from #2646. I thought it deserved to be merged, even if the rest of that PR is not being worked on. I also implemented a suggestion from @smowton on that PR to make a new class
is_invalid_pointer_exprt
. The same could be done for many other pointer predicates, but I do not have time right now.