-
Notifications
You must be signed in to change notification settings - Fork 274
Stop generating nondet pointees for function pointers #4940
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
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: e5d5c9f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/120202139
Codecov Report
@@ Coverage Diff @@
## develop #4940 +/- ##
========================================
Coverage 67.38% 67.38%
========================================
Files 1157 1157
Lines 95096 95096
========================================
Hits 64080 64080
Misses 31016 31016
Continue to review full report at Codecov.
|
a0308a5
to
68c9554
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: 68c9554).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/144957668
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 comes up a lot, maybe we should have a utility function like is_pointer_to_object
or something of the sort?
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.
🚫 Please add a test for when there is a function of the right type, to check it is selected. And two functions of the right type, to check it picks between them (as I believe the new behaviour should / old behaviour did not).
@@ -48,7 +48,7 @@ void symbol_factoryt::gen_nondet_init( | |||
return; | |||
} | |||
|
|||
if(type.id()==ID_pointer) | |||
if(type.id() == ID_pointer && to_pointer_type(type).subtype().id() != ID_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.
❓ What happens with pointers to code then? Just random number?
Read the PR description - that is worth a comment here explaining why we don't need to initialize it here
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.
Now the symbol is explicitly assigned a nondet (of the function-ptr type).
68c9554
to
9ea6857
Compare
I've added the tests. Note that existing functions will only be considered as candidates if dereferenced somewhere in the code. |
when building the entry point. Because that leads to declaring function-type objects and then assigning values to them. Rather we should simply initialise the function pointer with NONDET(fptr_type) and let the function-pointer removal find the candidates.
9ea6857
to
1299a54
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.
LGTM, thanks for the extra tests.
This just needs code owner approval @tautschnig @kroening
currently failing CI, but looks transient, have restarted the job |
will be squashed.
This is now passing CI and just needs code owner approval @tautschnig @kroening |
when building the entry point. Because that leads to declaring function-type
objects and then assigning values to them. Rather we should simply initialise
the function pointer with NONDET(fptr_type) and let the function-pointer removal
find the candidates.