-
Notifications
You must be signed in to change notification settings - Fork 273
Reachability slicer: mark reachable code more precisely #2195
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
Merged
smowton
merged 1 commit into
diffblue:develop
from
smowton:smowton/feature/smarter-reachability-slicer
May 21, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include <assert.h> | ||
|
||
// After a reachability slice based on the assertion in `target`, we should | ||
// retain both its possible callers (...may_call_target_1, ...may_call_target_2) | ||
// and their callees, but should be more precise concerning before_target and | ||
// after_target, which even though they are also called by | ||
// `unreachable_calls_before_target` and `unreachable_calls_after_target`, those | ||
// functions are not reachable. | ||
|
||
void before_target() | ||
{ | ||
const char *local = "before_target_kept"; | ||
} | ||
|
||
void after_target() | ||
{ | ||
const char *local = "after_target_kept"; | ||
} | ||
|
||
void target() | ||
{ | ||
const char *local = "target_kept"; | ||
|
||
before_target(); | ||
assert(0); | ||
after_target(); | ||
} | ||
|
||
void unreachable_calls_before_target() | ||
{ | ||
const char *local = "unreachable_calls_before_target_kept"; | ||
before_target(); | ||
} | ||
|
||
void unreachable_calls_after_target() | ||
{ | ||
const char *local = "unreachable_calls_after_target_kept"; | ||
after_target(); | ||
} | ||
|
||
void reachable_before_target_caller_1() | ||
{ | ||
const char *local = "reachable_before_target_caller_1_kept"; | ||
} | ||
|
||
void reachable_after_target_caller_1() | ||
{ | ||
const char *local = "reachable_after_target_caller_1_kept"; | ||
} | ||
|
||
void reachable_may_call_target_1() | ||
{ | ||
const char *local = "reachable_may_call_target_1_kept"; | ||
reachable_before_target_caller_1(); | ||
target(); | ||
reachable_after_target_caller_1(); | ||
} | ||
|
||
void reachable_before_target_caller_2() | ||
{ | ||
const char *local = "reachable_before_target_caller_2_kept"; | ||
} | ||
|
||
void reachable_after_target_caller_2() | ||
{ | ||
const char *local = "reachable_after_target_caller_2_kept"; | ||
} | ||
|
||
void reachable_may_call_target_2() | ||
{ | ||
const char *local = "reachable_may_call_target_2_kept"; | ||
reachable_before_target_caller_2(); | ||
target(); | ||
reachable_after_target_caller_2(); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
test.c | ||
--reachability-slice-fb --show-goto-functions | ||
target_kept | ||
reachable_before_target_caller_1_kept | ||
reachable_after_target_caller_1_kept | ||
reachable_may_call_target_1_kept | ||
reachable_before_target_caller_2_kept | ||
reachable_after_target_caller_2_kept | ||
reachable_may_call_target_2_kept | ||
-- | ||
unreachable_calls_before_target_kept | ||
unreachable_calls_after_target_kept |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this true also for GOTO obtained from a
C
program (e.g. a call via a 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.
cfgt
requires thatremove_function_pointer
has run (it ignores function calls that don't call anID_symbol
)