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

Specification on codatatype function triggers wrong encoding #4990

Open
MikaelMayer opened this issue Jan 16, 2024 · 0 comments
Open

Specification on codatatype function triggers wrong encoding #4990

MikaelMayer opened this issue Jan 16, 2024 · 0 comments
Labels
during 2: compilation of correct program Dafny rejects a valid program during compilation kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag priority: next Will consider working on this after in progress work is done

Comments

@MikaelMayer
Copy link
Member

Dafny version

latest-nightly

Code to produce this issue

// A heap is an infinite stream of heap fields
  codatatype Heap = HeapElem(alloc: bool, tail: Heap)
  {
    predicate AllFalse() {
      !alloc && tail.AllFalse()
    }
    static function Init(): Heap
      ensures Init().AllFalse()
    {
      HeapElem(false, Init())
    }
  }
  method {:test} Test() {
    var h := Heap.Init();
  }

Command to run and resulting output

SHIFT+F5 to run the tests in VSCode.

Test: Stack overflow.
Repeat 19261 times:
--------------------------------
   at _module.Heap.Init()
--------------------------------
   at _module.__default.Test()

What happened?

Init() was compiled like a regular method. If I remove the specification, it works.

What type of operating system are you experiencing the problem on?

Windows

@MikaelMayer MikaelMayer added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Jan 16, 2024
@keyboardDrummer keyboardDrummer added during 4: bad execution of correct program A bug in the Dafny compiler that causes a correct Dafny program to execute incorrectly priority: not yet Will reconsider working on this when we're looking for work priority: next Will consider working on this after in progress work is done during 2: compilation of correct program Dafny rejects a valid program during compilation part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag and removed priority: not yet Will reconsider working on this when we're looking for work during 4: bad execution of correct program A bug in the Dafny compiler that causes a correct Dafny program to execute incorrectly labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
during 2: compilation of correct program Dafny rejects a valid program during compilation kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: code-generation Support for transpiling Dafny to another language. If relevant, add a `lang:` tag priority: next Will consider working on this after in progress work is done
Projects
None yet
Development

No branches or pull requests

2 participants