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

Crash on reads with different datatype ordering #5232

Open
txiang61 opened this issue Mar 21, 2024 · 1 comment · May be fixed by #5496
Open

Crash on reads with different datatype ordering #5232

txiang61 opened this issue Mar 21, 2024 · 1 comment · May be fixed by #5496
Assignees
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking priority: next Will consider working on this after in progress work is done

Comments

@txiang61
Copy link

Dafny version

4.5.0

Code to produce this issue

class S { }

datatype A = A(s: S) {}

datatype C = C(b: B) {

  static ghost const f := (x: C) 
    reads x.b.a.s => x.ToSpec()
  
  ghost function ToSpec(): bool
    reads b.a.s
}

datatype B = B(a: A) {}

Command to run and resulting output

dafny verify --warn-shadowing --relax-definite-assignment=false --isolate-assertions --general-traits=datatype --type-system-refresh

What happened?

Crashes. Verifies if switch the order of datatype B and datatype C.

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

Mac

@txiang61 txiang61 added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Mar 21, 2024
@robin-aws robin-aws added crash Dafny crashes on this input, or generates malformed code that can not be executed during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program priority: next Will consider working on this after in progress work is done labels Mar 21, 2024
@keyboardDrummer keyboardDrummer added the part: resolver Resolution and typechecking label Apr 29, 2024
@stefan-aws stefan-aws self-assigned this May 14, 2024
@stefan-aws
Copy link
Collaborator

A more refined example that crashes with --type-system-refresh and verifies without:

class S {}

class C {
  const f := (x: B') reads x.s => true // doesn't fail
  const g := (x: B) reads x.s => true // fails
}

datatype C' = C'() {
  const f := (x: B') reads x.s => true // doesn't fail
  const g := (x: B) reads x.s => true // fails
}

datatype B = B(s: S) {}

class B' {
  const s: S
  constructor B'(s: S) {
    this.s := s;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking priority: next Will consider working on this after in progress work is done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants