-
Notifications
You must be signed in to change notification settings - Fork 277
Interface for collecting function pointer targets #4536
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
4bebc52
to
240fcda
Compare
434e869
to
715ee95
Compare
7853563
to
d9c92a0
Compare
f54b052
to
6a410e5
Compare
101bf06
to
e0f1172
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.
This PR failed Diffblue compatibility checks (cbmc commit: 101bf06).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/108667731
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
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 PR failed Diffblue compatibility checks (cbmc commit: e0f1172).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/108669241
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
e0f1172
to
327099a
Compare
74584f8
to
81b2a4c
Compare
@tautschnig Well, there is a conversation. @kroening raised the issue that with this PR's changes |
81b2a4c
to
abedd92
Compare
No functional change.
Move the checks for is_function_call and does-return-anything outside; and pre-compute the is_stub. do_function_call now always does something.
Also extract the common behaviour to do_function_calls.
The type and the function to return the map.
In case the function id is dereference we grab the set of possible targets (via the possible_fp_targets_map) and pass it to the new do_function_call method. There we build a cond_expr by iterating over the possible targets and adding a case: (f==target ? target_return_value) to it. This cond_expr then becomes the right-hand-side of the new assignment. We also have to dead all the return values that were created, see https://github.com/martin-cs/ASVAT/issues/46. Also building remove_function_pointerst requires messaget And now so does remove_returnst, hence extending the call sites as well.
From remove_function_pointers to a separate function split into three: 1. get_funtion_pointer_targets .. the wrapper (for model/program) 2. refine_call_type .. for incomplete function types 3. try_remove_const_fp .. call remove_const_function_pointer Then implement a wrapper that returns a map: function-name -> list-of-candidates
Using the new candidate-collecting function.
Introducing two new member function: 1. build_new_code .. wraps the collection of function calls and gotos 2. remove_function_pointer_log .. wraps the logging and statistics Setting the location now takes place inside the loop over candidate functions: there is no second loop over newly introduced gotos.
And update the unit makefile.
And correctly report the case when there are no targets.
so that message handler is not the first.
that was not up-to-date.
matching variant function pointer to a complete function.
from a function call expression.
on a per-callee basis. To prevent the state for one callee to be used when removing pointers for another callee.
that takes the target map as argument. To avoid duplication we also refactor the existing functions a bit.
will be squashed.
abedd92
to
576b7ca
Compare
@martin-cs It was a good thing that you suggested a new interface taking the |
will be squashed.
@martin-cs and @kroening I've put together an alternative implementation in #4650. It does the same thing but the collection of function pointers is completely separate from remove-function-pointers. I also describe there how remove-returns will differ from remove-function-pointers there. It share some commits to this PR so if you want to read it, I recommend starting here: 5a39535. |
Perhaps it would be useful for me to say why this functionality was desirable. I would like to be able to run |
Closing due to age. If you believe this is erroneous please reopen and update the PR. |
Motivation: we want
remove_returns
to work even if not preceded byremove_function_pointers
. For example:This PR exposes the function-pointer-target-collecting part of
remove_function_pointers
to be used in other analyses and the does so inremove_returns
.In
remove_returns
use thepossible_fp_targets_map
to be able to remove returns for calls to function pointers.CALL x=*fp()
should becomeCALL *fp(); ASSIGN x = (fp == &f00) ? return_value_f00 : (fp == &f01) ?
....The first 3 commits are refactoring/preparation. The fourth introduces the interface. The fifth implements the new
do_function_call
for function pointers.Then we refactor the
remove_function_pointers
to extract the collect-candidate-functions part and separate the modify-function-call part.Finally -- now that the file is open -- we also refactor the internal
remove_function_pointers
without any functional change.