-
Notifications
You must be signed in to change notification settings - Fork 273
goto-instrument: function pointer removal with value_set_fi #5436
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
Conversation
3bb4f5c
to
d09b28c
Compare
1e4db2b
to
100d938
Compare
Codecov Report
@@ Coverage Diff @@
## develop #5436 +/- ##
===========================================
+ Coverage 68.25% 68.30% +0.05%
===========================================
Files 1180 1181 +1
Lines 97722 97814 +92
===========================================
+ Hits 66698 66811 +113
+ Misses 31024 31003 -21
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
e98cce3
to
443c0ea
Compare
I think this is now ready to merge, is anyone available to review it? |
8645143
to
afdffc7
Compare
I'll get to this this weekend |
Is anyone free to review this please? |
@polgreen sorry for the lag, will try to look tomorrow. |
afdffc7
to
f0d68fc
Compare
e379fbd
to
da91cea
Compare
I think all changes requested are now made |
#include <util/std_code.h> | ||
#include <util/union_find.h> | ||
|
||
#ifdef USE_STD_STRING |
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.
Not quite sure what this is for?
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.
Needed for one of the CI tests, which compiles with this flag and needs this include to compile
|
||
void value_set_fi_fp_removal(goto_modelt &goto_model) | ||
{ | ||
std::cout << "Doing FI value set analysis\n"; |
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.
Should take a messaget
and use that instead I’d think?
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.
that's outdated, it's changed in the latest commit
new_code.destructive_append(final_skip); | ||
|
||
// set locations | ||
Forall_goto_program_instructions(it, new_code) |
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.
This could be done without macros:
for(auto const &instruction : new_code.instructions)
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 need to drop the const in that.
Are the macros now deprecated? Because couldn't everything that is written using the macro also be written without?
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.
They have been deprecated for some time now in favour of the new-style for
loops. As to why...
@polgreen I will review next. |
^SIGNAL=0$ | ||
^ function: f$ | ||
-- | ||
^ function: g$ |
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.
Negative as well as positive tests are good.
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 have Opinions on how function pointer removal should be done but I will spare you those. I think this is a step in the right direction. Thank you especially for the detailed test cases.
int main(void) | ||
{ | ||
fp_t fp; | ||
fp(); |
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.
Again, anything that happens after this seems a bit dubious to me.
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've flipped the order of the delcarations now
new_code.destructive_append(final_skip); | ||
|
||
// set locations | ||
Forall_goto_program_instructions(it, new_code) |
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.
They have been deprecated for some time now in favour of the new-style for
loops. As to why...
code_assignt(old_lhs, typecast_exprt(tmp_symbol_expr, old_lhs.type())))); | ||
} | ||
|
||
void remove_function_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.
It is good to see this bit of functionality broken out.
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.
If the macros are deprecated, perhaps they should be marked as deprecated in the goto_program.h?
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 was a move to simply replace them all in one go which would have basically caused a number of forks, I think the compromise was the linter would flag them in new code and they would be deprecated 'at some point'. I guess the linter doesn't so... yeah, yeah it would be a good idea.
@@ -1197,6 +1197,9 @@ void value_set_fit::assign_rec( | |||
{ | |||
const typet &type = to_index_expr(lhs).array().type(); | |||
|
|||
if(type.id() != ID_array) |
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.
❓ This makes the second part of the condition in the data invariant below unreachable.
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've removed this from the PR
da91cea
to
7486abb
Compare
7486abb
to
1c31179
Compare
This adds a new option to goto-instrument for removing function pointers. The points-to analysis is done using flow-insensitive value sets, which is more precise than using the signature of the function to identify the points-to set. Co-authored-by: Elizabeth Polgreen [email protected]
1c31179
to
2960187
Compare
I've now addressed all of the comments in the reviews |
Thanks @polgreen ! @peterschrammel and @hannes-steffenhagen-diffblue do you have further comments or can this be merged as it is? |
This adds a new option to goto-instrument for removing function pointers.
The points-to analysis is done using flow-insensitive value sets, which is
more precise than using the signature of the function to identify the
points-to set.