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

fix: Check extreme predicates and constants in all types, not just classes #2515

Merged
merged 2 commits into from
Jul 29, 2022

Conversation

cpitclaudel
Copy link
Member

The bug was latent in 923f812 (for datatypes), but the issue with const only
became exploitable in c5562f2 (previous to that Boogie's own cyclicity checks
replaced the missing ones in Dafny).

  • Source/Dafny/Resolver.cs (ResolveTopLevelDecls_Core):
    Run member checks on all declarations with members — not just on classes.

Closes #2506.

We were running none of the extreme lemma checks for datatypes, newtypes, and abstract type members. I added tests, but for casual readers, here are four examples:

  datatype T = A {
    static const a := 1 + b;
    static const b := 2 + a;

    static predicate F() decreases 0 { !L() }
    static least predicate L() { F() }

    static least predicate Negative() { !Negative() }
    static least predicate Ensures() ensures false { Ensures() }
  }

  method Oops0() ensures false { var _ := T.Ensures(); }
  method Oops1() ensures false { var _ := T.a; }
  method Oops2() ensures false { var _ := T.F(); }
  method Oops3() ensures false { var _ := T.Negative(); }

…asses

The bug was latent in 923f812 (for datatypes), but the issue with `const` only
became exploitable in c5562f2 (previous to that Boogie's own cyclicity checks
replaced the missing ones in Dafny).

* `Source/Dafny/Resolver.cs` (`ResolveTopLevelDecls_Core`):
  Run member checks on all declarations with members — not just on classes.

Closes #2506.
@cpitclaudel cpitclaudel force-pushed the cpitclaudel_2506-check-const-init-cycles branch from 53e36ff to 16f6775 Compare July 29, 2022 05:07
@cpitclaudel cpitclaudel enabled auto-merge (squash) July 29, 2022 17:26
@cpitclaudel cpitclaudel merged commit c30df1b into master Jul 29, 2022
@cpitclaudel cpitclaudel deleted the cpitclaudel_2506-check-const-init-cycles branch July 29, 2022 17:44
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.

Soundness issue from mutual reference in datatype
2 participants