Skip to content
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

Added proper support for __VERIFIER_assert #628

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

ThomasHaas
Copy link
Collaborator

This PR adds support for __VERIFIER_assert. Unlike standard assertions, the verifier version will not create control-flow branching (i.e. it does not termiante the program when violated) and hence does not create control dependencies.
However, the user still has to be careful to avoid short-circuiting connectives because those will induce control-flow dependencies:

int r = x;
__VERIFIER_assert(r == 0)
y = 5 // No ctrl-dep to load

--------

int r = x;
__VERIFIER_assert(r == 0 || r == 1) // short-circuiting adds ctrl-dep: use "bitwise or" instead
y = 5 // Accidental ctrl-dep to load

@hernanponcedeleon
Copy link
Owner

Did you notice any visible performance change now that the SMT solver needs to find full executions rather than terminating them soon?

@ThomasHaas
Copy link
Collaborator Author

ThomasHaas commented Feb 28, 2024

No, this is not used anywhere (except the one new benchmark I added). You would need to recompile all benchmarks to use __VERIFIER_assert. For programs that use assert from <assert.h>, nothing changes.

@hernanponcedeleon
Copy link
Owner

Right. I will make a full run of svcomp benchmarks to test this.

@hernanponcedeleon
Copy link
Owner

The svcomp results show no problems, thus I'll merge

@hernanponcedeleon hernanponcedeleon merged commit e3248f7 into development Feb 29, 2024
1 check passed
@hernanponcedeleon hernanponcedeleon deleted the verifier_assert branch February 29, 2024 17:09
@ThomasHaas
Copy link
Collaborator Author

The svcomp results show no problems, thus I'll merge

Does this even make sense? I think Svcomp uses no __VERIFIER_assert because our previous code didn't even handle it correctly.
I think they use the standard assert from <assert.h> which is witnessed by the implementation of reach_error:

#include <assert.h>
void reach_error() { assert(0); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants