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

[CONTRACTS] Use fresh converter in loop contracts instrumentation #8282

Conversation

qinheping
Copy link
Collaborator

Use fresh converter during loop contracts instrumentation to make sure the jumps in the loop invariants will be correctly directed.

  • 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).
  • 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.

Copy link

codecov bot commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.21%. Comparing base (f18b509) to head (7273894).
Report is 28 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8282      +/-   ##
===========================================
+ Coverage    77.55%   78.21%   +0.66%     
===========================================
  Files         1721     1722       +1     
  Lines       190128   188648    -1480     
  Branches     18438    18452      +14     
===========================================
+ Hits        147448   147547      +99     
+ Misses       42680    41101    -1579     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qinheping qinheping force-pushed the bugfixes/use_fresh_converter_in_contracts branch from 2e0e50b to 0227040 Compare June 5, 2024 04:18
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test to demonstrate what difference this makes?

@@ -150,7 +149,6 @@ class code_contractst
goto_functionst &goto_functions;

messaget &log;
goto_convertt converter;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove #include <ansi-c/goto-conversion/goto_convert_class.h> from this file and move it to the .cpp file.

@qinheping
Copy link
Collaborator Author

Could you please add a test to demonstrate what difference this makes?

The test will be loop invariants as statement expressions containing GOTO statements, such as


int main()
{
  unsigned char *i = malloc(5);

  while(i != i + 5)
    __CPROVER_loop_invariant(({
      goto label;
      unsigned b = 1 == 1;
    label:
      b;
    }))
    {
      const char lower = *i++;
    }
}

However, such loop invariant doesn't typecheck now as statement expression are side-effect expression, even thought this loop invariant is side-effect free. I will refactor #8281 soon to allow such side-effect free statement expression, and add the test in #8281.

@qinheping qinheping force-pushed the bugfixes/use_fresh_converter_in_contracts branch from 0227040 to 7273894 Compare June 5, 2024 16:51
@qinheping qinheping enabled auto-merge June 5, 2024 16:52
@qinheping qinheping merged commit b465e80 into diffblue:develop Jun 5, 2024
39 of 40 checks passed
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