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

Bug in program evaluation/verification #287

Open
mantognini opened this issue Dec 15, 2016 · 0 comments
Open

Bug in program evaluation/verification #287

mantognini opened this issue Dec 15, 2016 · 0 comments
Labels

Comments

@mantognini
Copy link
Contributor

This particular piece of code will trigger a postcondition violation on evaluation and an invalid verification with an empty counter example for _main but should not.

/* Copyright 2009-2016 EPFL, Lausanne */

import leon.annotation.extern

object Aliasing4 {

  case class MutableInteger(var x: Int)

  def selector(first: Boolean, i: MutableInteger, j: MutableInteger) {
    mutate(if (first) i else j)
  }

  def mutate(m: MutableInteger) {
    m.x = 0
  }

  def _main(): Int = {
    val a = MutableInteger(42)
    val b = MutableInteger(58)

    selector(first = true, a, b)

    if (a.x == 0) {
      if (b.x == 58) 0
      else 2
    } else 1
  } ensuring { _ == 0 }

  @extern
  def main(args: Array[String]): Unit = _main()
}

Running this program on the JVM yield no errors and _main indeed returns 0.

When this is fixed, src/test/resources/regression/genc/unverified/Aliasing4.scala should be moved to src/test/resources/regression/genc/valid/Aliasing4.scala (ATM only available on topic/genc_v2 branch).

@mantognini mantognini added the bug label Dec 15, 2016
mantognini added a commit that referenced this issue Dec 15, 2016
 - Aliasing3 is disabled because it make verification crash (see #289)
 - Aliasing4 is disabled because it make verification produce incorrect counter-example (see #287)
 - Inheritance9 is disabled because it make xlang crash (see #288)
 - UsingConcreteCLasses is enabled because verification is easy
mantognini added a commit that referenced this issue Dec 15, 2016
 - Aliasing3 is disabled because it make verification crash (see #289)
 - Aliasing4 is disabled because it make verification produce incorrect counter-example (see #287)
 - Inheritance9 is disabled because it make xlang crash (see #288)
 - UsingConcreteCLasses is enabled because verification is easy
mantognini added a commit that referenced this issue Jan 25, 2017
 - Aliasing3 is disabled because it make verification crash (see #289)
 - Aliasing4 is disabled because it make verification produce incorrect counter-example (see #287)
 - Inheritance9 is disabled because it make xlang crash (see #288)
 - UsingConcreteCLasses is enabled because verification is easy
mantognini added a commit that referenced this issue Feb 13, 2017
 - Aliasing3 is disabled because it make verification crash (see #289)
 - Aliasing4 is disabled because it make verification produce incorrect counter-example (see #287)
 - Inheritance9 is disabled because it make xlang crash (see #288)
 - UsingConcreteCLasses is enabled because verification is easy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant