Skip to content

CONTRACTS: make __CPROVER_is_fresh call-local. #6813

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

Conversation

remi-delmas-3000
Copy link
Collaborator

The previous implementation of the __CPROVER_is_fresh predicates used a global static map, which caused different occurrences of a function call from same call site to interfere.

We now use a locally allocated memory map which solves the problem.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [] The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [N/A] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Apr 15, 2022

Codecov Report

Merging #6813 (b9290e4) into develop (aed93c8) will increase coverage by 0.00%.
The diff coverage is 98.70%.

@@           Coverage Diff            @@
##           develop    #6813   +/-   ##
========================================
  Coverage    76.99%   77.00%           
========================================
  Files         1594     1594           
  Lines       184263   184348   +85     
========================================
+ Hits        141872   141954   +82     
- Misses       42391    42394    +3     
Impacted Files Coverage Δ
src/goto-instrument/contracts/memory_predicates.h 100.00% <ø> (ø)
src/solvers/smt2/smt2_conv.h 100.00% <ø> (ø)
...c/solvers/smt2_incremental/convert_expr_to_smt.cpp 84.53% <0.00%> (-0.35%) ⬇️
src/util/simplify_expr_class.h 90.47% <ø> (ø)
src/util/std_expr.h 93.18% <ø> (ø)
src/ansi-c/c_typecheck_expr.cpp 77.05% <100.00%> (-0.02%) ⬇️
src/ansi-c/goto_check_c.cpp 91.47% <100.00%> (ø)
src/goto-instrument/contracts/contracts.cpp 93.89% <100.00%> (+0.07%) ⬆️
...rc/goto-instrument/contracts/memory_predicates.cpp 85.49% <100.00%> (+1.96%) ⬆️
src/solvers/flattening/bv_pointers.cpp 83.09% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c58a89...b9290e4. Read the comment docs.

The previous implementation of the predicates
used a global static map to check for
aliasing between pointers, which caused different
calls to a same function (from a same call site)
to interfere.

We now use locally declared memory maps to track
aliasing seen by the predicates which solves the
problem, since every call will use a freshly
zero-initialised map.

format fixes
@remi-delmas-3000 remi-delmas-3000 force-pushed the fix-is-fresh-call-local branch from 5ff1a04 to b9290e4 Compare April 15, 2022 21:02
@tautschnig tautschnig merged commit abc4e01 into diffblue:develop Apr 17, 2022
@feliperodri feliperodri added aws Bugs or features of importance to AWS CBMC users Code Contracts Function and loop contracts labels Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users Code Contracts Function and loop contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants