-
Notifications
You must be signed in to change notification settings - Fork 273
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
CONTRACTS: force success for necessary pointer predicates #8574
CONTRACTS: force success for necessary pointer predicates #8574
Conversation
9e8e5c2
to
e840bec
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8574 +/- ##
===========================================
- Coverage 78.94% 78.87% -0.07%
===========================================
Files 1732 1732
Lines 198845 199066 +221
Branches 18351 18560 +209
===========================================
+ Hits 156974 157021 +47
- Misses 41871 42045 +174 ☔ View full report in Codecov by Sentry. |
Force success for pointer predicates that must necessarily hold if they ever get invoked in an assumption context. This ensures that the value sets of pointers as as small as possible after assuming a requires or an ensures clause and solves a performance issue with z3. All predicates in the `cprover_contracts.c` library now have an extra input `may_fail` controlling the failure behaviour, DFCC instrumentation sets the `may_fail` parameter to true or false using recursive algorithm.
e840bec
to
3ddd4b6
Compare
mlkem-native CI running for this PR here: pq-code-package/mlkem-native#688 |
This is looking good @remi-delmas-3000; mlkem-native CI passing on pq-code-package/mlkem-native#688 without noticable performance regresisons. Thanks a lot 🎉! |
Force success for pointer predicates that must necessarily hold if they ever get invoked in an assumption context. This ensures that the value sets of pointers as as small as possible after assuming a requires or an ensures clause and solves a performance issue with z3. All predicates in the
cprover_contracts.c
library now have an extra inputmay_fail
controlling the failure behaviour, DFCC instrumentation sets themay_fail
parameter to true or false using a recursive downwards propagation algorithm that takes into account the shortcutting behaviour of==>
,&&
and||
. This applies to all predicates (pointer_equals, is_fresh, pointer_in_range and obeys_contract for function pointers).The test that regressed due to #8562 now passes again.
Example
Is tagged as follows :
In order for the the requires clause to hold when assumed, the
is_fresh
predicates in the RHS of implicationsmust not fail if they ever get invoked, those left of disjunctions may fail
Example
Will be tagged
The top conjuncts may not fail for the whole expression to hold, and the last element of the disjunction may not fail if it ever gets invoked after all other leftmost disjuncts may have failed.