-
Notifications
You must be signed in to change notification settings - Fork 273
Difficulty using "assert(false)" for unimplemented functions #6393
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
Comments
We tried this with #include <stdlib.h>
int main() {
void *x = malloc(1);
assert(x != 0);
} commandline:
|
If we use int main() {
void *x = malloc(1); // should not be replaced by `assert(false);`
assert(x != 0);
void *y = mallocx(1); // should be replaced by `assert(false);`
assert(y != 0);
} commandline:
|
Also, rather than just throwing an assert false violation it would save a lot of debug effort if we got an error of the form "undefined function reached". |
That sounds like a worthwhile improvement, but it is slightly off track from the original problem described in this issue. I have raised a task in my team's internal tracking system, to keep track of your suggestion. |
It seems like Saswat has managed to find a way to make the functionality you wanted work for the moment. I think that ideally we should generate an appropriate warning/suggestion if an attempt is made to generate function bodies, before the standard libraries have been linked. |
One could argue that this is a symptom of a more general issue, which is how to we ensure that folks run the steps of a transformation in the right order. We might want to look at annotating code with information about what has/has-not been done to it so we can check if further transformations are safe. There is an RFC started over on #6495 to discuss that. Can we close this issue and pick up the discussion over there? |
Just confirming that using
|
When using --generate-function-body with "assert-false" or "assert-false-assume-false" make sure we produce a more meaningful description than "assertion false." Instead, make the comment say "undefined function should be unreachable." Fixes: diffblue#6393
When using --generate-function-body with "assert-false" or "assert-false-assume-false" make sure we produce a more meaningful description than "assertion false." Instead, make the comment say "undefined function should be unreachable." Fixes: diffblue#6393
I am trying to use
assert(false)
instead ofreturn __nondet()
for missing functions to increase soundness. You can see the code, and the failure, on this PR for RMC https://github.com/model-checking/rmc/pull/535/filesIf I use the arguments
'--generate-function-body-options', 'assert-false', '--generate-function-body', '.*'
, I see the expected failure for missing functions, but also references to missing standard library functions, which was unexpected. Is there a better way to do this?The text was updated successfully, but these errors were encountered: