-
Notifications
You must be signed in to change notification settings - Fork 274
Add support for void* pointers in goto-harness #5290
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
thk123
merged 11 commits into
diffblue:develop
from
thk123:goto-harness-void-star-pointers
Apr 9, 2020
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
652bf92
Add test for intializing a void* pointer
dc62373
Add missing includes to tests
0151c89
Special case handling for void* pointers
c65edee
Adapt comment to more accurately reflect generated code
06a95b5
Combine code for assigning null pointer
1bbd0f8
Add a test for array of void* pointers
33294f6
Add tests for when pointer parameters have special semantics
ff1f4b0
Ensure void* pointers instructed to be arrays are null-initalized
117f553
Add a test for an array we can initalize
11a48f4
Consolidate check for void* pointer initilization
2f2a233
Change assert false assertions
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
2 changes: 2 additions & 0 deletions
2
regression/goto-harness/do_not_nondet_globals_by_default/main.c
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#include <assert.h> | ||
|
||
int a_global; | ||
|
||
void entry_function(void) | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#include <assert.h> | ||
|
||
int x = 1; | ||
|
||
int main() | ||
|
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,14 @@ | ||
#include <assert.h> | ||
#include <stdbool.h> | ||
|
||
void test_function(void *input) | ||
{ | ||
assert(input == 0); | ||
} | ||
|
||
void test_void_array(void *input_array[10]) | ||
{ | ||
__CPROVER_assume(input_array != 0); | ||
assert(input_array[0] == 0); | ||
assert(false); | ||
} |
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,12 @@ | ||
CORE | ||
main.c | ||
--harness-type call-function --function test_void_array | ||
\[test_void_array\.assertion\.1\] line \d+ assertion input_array\[0\] == 0: SUCCESS | ||
\[test_void_array\.assertion\.2\] line \d+ assertion false: FAILURE | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
-- | ||
Ensure the harness is able to initalize an array of void* pointers where | ||
the array is non-null, but the elements are null. |
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,10 @@ | ||
CORE | ||
main.c | ||
--harness-type call-function --function test_function | ||
\[test_function\.assertion\.1\] line \d+ assertion input == 0: SUCCESS | ||
^VERIFICATION SUCCESSFUL$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
-- | ||
Ensure the harness is able to initalize a void* ptr to a null value. |
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.
👍 A lot of tests forget this step