summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Dafny/Translator.cs8
-rw-r--r--Test/dafny4/Bug133.dfy18
-rw-r--r--Test/dafny4/Bug133.dfy.expect2
3 files changed, 24 insertions, 4 deletions
diff --git a/Source/Dafny/Translator.cs b/Source/Dafny/Translator.cs
index cfb77d84..0314344d 100644
--- a/Source/Dafny/Translator.cs
+++ b/Source/Dafny/Translator.cs
@@ -11222,7 +11222,7 @@ namespace Microsoft.Dafny {
bOpcode = BinaryOperator.Opcode.Lt;
break;
} else {
- return TrToFunctionCall(expr.tok, "INTERNAL_lt_boogie", Bpl.Type.Int, e0, e1, liftLit);
+ return TrToFunctionCall(expr.tok, "INTERNAL_lt_boogie", Bpl.Type.Bool, e0, e1, liftLit);
}
case BinaryExpr.ResolvedOpcode.Le:
@@ -11232,7 +11232,7 @@ namespace Microsoft.Dafny {
bOpcode = BinaryOperator.Opcode.Le;
break;
} else {
- return TrToFunctionCall(expr.tok, "INTERNAL_le_boogie", Bpl.Type.Int, e0, e1, false);
+ return TrToFunctionCall(expr.tok, "INTERNAL_le_boogie", Bpl.Type.Bool, e0, e1, false);
}
case BinaryExpr.ResolvedOpcode.Ge:
keepLits = true;
@@ -11241,7 +11241,7 @@ namespace Microsoft.Dafny {
bOpcode = BinaryOperator.Opcode.Ge;
break;
} else {
- return TrToFunctionCall(expr.tok, "INTERNAL_ge_boogie", Bpl.Type.Int, e0, e1, false);
+ return TrToFunctionCall(expr.tok, "INTERNAL_ge_boogie", Bpl.Type.Bool, e0, e1, false);
}
case BinaryExpr.ResolvedOpcode.Gt:
if (isReal || !DafnyOptions.O.DisableNLarith) {
@@ -11249,7 +11249,7 @@ namespace Microsoft.Dafny {
bOpcode = BinaryOperator.Opcode.Gt;
break;
} else {
- return TrToFunctionCall(expr.tok, "INTERNAL_gt_boogie", Bpl.Type.Int, e0, e1, liftLit);
+ return TrToFunctionCall(expr.tok, "INTERNAL_gt_boogie", Bpl.Type.Bool, e0, e1, liftLit);
}
case BinaryExpr.ResolvedOpcode.Add:
if (!DafnyOptions.O.DisableNLarith) {
diff --git a/Test/dafny4/Bug133.dfy b/Test/dafny4/Bug133.dfy
new file mode 100644
index 00000000..f7da133e
--- /dev/null
+++ b/Test/dafny4/Bug133.dfy
@@ -0,0 +1,18 @@
+// RUN: %dafny /noNLarith /compile:0 "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+module Math__div_def_i {
+ function my_div_pos(x:int, d:int) : int
+ requires d > 0;
+ decreases if x < 0 then (d - x) else x;
+ {
+ if x < 0 then
+ -1 + my_div_pos(x+d, d)
+ else if x < d then
+ 0
+ else
+ 1 + my_div_pos(x-d, d)
+ }
+}
+
+
diff --git a/Test/dafny4/Bug133.dfy.expect b/Test/dafny4/Bug133.dfy.expect
new file mode 100644
index 00000000..c0c48e2b
--- /dev/null
+++ b/Test/dafny4/Bug133.dfy.expect
@@ -0,0 +1,2 @@
+
+Dafny program verifier finished with 1 verified, 0 errors